Live Layout

Hi, I have a problem, after update live_view to v0.9. I use default app layout ,
through :put_live_layout, {AppWeb.LayoutView, "app.html"}
and live layout in live_view e.g use Phoenix.LiveView, layout: {AppWeb.LayoutView, "live.html"}.
When i use in layout only <%= @inner_content %> everything work fine, but if i try to render view in a live layout e.g <%= live_render(@socket, AppWeb.Pages.Header, id: "service_header") %> <%= @inner_content %> content of page is rendered by twice.
What I do wrong?

Are you also using the layout in AppWeb.Pages.Header? If so, then both the parent view and the child view would be using this layout. We have improved this a bit in LiveView master, so I recommend using that instead. See the CHANGELOG for more info. :slight_smile:

1 Like

No, I didn’t use layout in a header view.
I noticed such a thing, if I am changing the order in live layout, e.g
<%= @inner_content %><%= live_render(@socket, AppWeb.Pages.Header, id: "service_header") %>
everything work fine.