Skip to content

Unauthorized live_redirect when using live_render inside a non-live view #4052

@thecristen

Description

@thecristen

Environment

  • Elixir version (elixir -v): 1.18.4
  • Phoenix version (mix deps): 1.8.1
  • Phoenix LiveView version (mix deps): 1.1.16
  • Operating system: MacOS
  • Browsers you attempted to reproduce this bug on (the more the merrier): Chrome, Safari
  • Does the problem persist after removing "assets/node_modules" and trying again? Yes/no: Yes

Actual behavior

I have a static page and I'm trying to embed a live view that will have an interactive map.

I am pretty much following the example in the documentation for live_render/3.

# inside templates/feature/show.html.heex
<div>
{live_render(@conn, MyApp.LiveMap)}
</div>

There's nothing in that live view yet -- just trying to render a static <p>.

Loading the page now has an infinite reloading problem, and here is what shows in the console --

phx-GHcAAZJQGTI02HMD error: unauthorized live_redirect. Falling back to page request -  {reason: 'stale'}
phoenix_live_view.esm.js:219  socket: disconnect for page nav
phoenix_live_view.esm.js:219 phx-GHcAAZJQGTI02HMD destroyed: the child has been removed from the parent
phoenix_live_view.esm.js:219  destroyed: the child has been removed from the parent 

Then the page refreshes and runs into the same error, repeat.

Expected behavior

No infinite reloading.

To reiterate for the question "what are you trying to do?" -- I have a static page and I'm trying to embed a live view that will have an interactive map. What's going on? Is what I am trying to do not possible?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions