Skip to content

Limited scope of live result when using live_render in root.html.heex with LiveView 1.1 #3917

@peaceful-james

Description

@peaceful-james

Environment

  • Elixir version (elixir -v): Elixir 1.19.0-rc.0
  • Phoenix version (mix deps): 1.8.0-rc.4
  • Phoenix LiveView version (mix deps): 1.1
  • Operating system: Ubuntu 22.04.5 LTS
  • Browsers you attempted to reproduce this bug on (the more the merrier): Chrome
  • Does the problem persist after removing "assets/node_modules" and trying again? Yes/no: Yes

Actual behavior

Hi,

I was trying out LiveView 1.1 last night and I noticed something strange.

I have a root.html.heex and it does a live_render of some navbar live view.

For some reason, when I write a test like this:

{:ok, view, html} = live(conn, ~p"/")

The view and html are limited to the live rendered navbar! Elements that are not in the navbar but are on the homepage are not accessible.

Something like

assert has_element?(view, "#div-on-home-page")

is failing because the expected element is not in the navbar but it is on the home page.

I ran the app and manually tested it and everything works fine. The problem has something to do with how live is working

Expected behavior

Is it not supported any more to use live_render in root.html.heex?

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