I followed a fresh install of mix phx.new my_app and a fresh install of LiveView using the install guide on HexDocs, but I can't seem to put it together in a working state.
plug :put_live_layout, {MyAppWeb.LayoutView, "app.html"} / plug :put_root_layout, {MyAppWeb.LayoutView, "app.html"} is not yet in the Installation Guide, so it took me a while to figure out why my live '/', ThingLive did not render any HTML of layout/app.html.eex.assign @conn not available in eex template. This seems logical, given that the documentation of LiveView shows examples with @socket instead of @conn, but it's also odd. Does LiveView not support sharing a layout with normal Phoenix templates?@conn results in the error expected MyAppWeb.LayoutView to return a %Phoenix.LiveView.Rendered{} struct. Here I am totally lost: how set up my LayoutView then, as a LiveView itself? And why does the changelog suggest putting in that plug, which points to a by default incompatible View?Am I missing something here, or did something break?
Thanks for the good stuff tho, and keep breaking it to make it better plz :)
Thanks for the clarification!
To answer my own questions with my new understanding:
live_render/2 in the template, which is probably considered the normal use-case. (This could be my solution already, I think: just use <%= live_render(@conn, ThingLive) %>, that might make more sense.)@conn or @socket in the root layout. 7fabadca8db1fd58084b93b491d0b44cdeff855b explains the difference between app.html.eex, live.html.leex and root.html.eex, and they seem to be stacking: if I put a :root _and_ a :live layout it (with <%= @inner_content %>) I see them both.
Most helpful comment
Thanks for the clarification!
To answer my own questions with my new understanding:
live_render/2in the template, which is probably considered the normal use-case. (This could be my solution already, I think: just use<%= live_render(@conn, ThingLive) %>, that might make more sense.)@connor@socketin the root layout. 7fabadca8db1fd58084b93b491d0b44cdeff855b explains the difference betweenapp.html.eex,live.html.leexandroot.html.eex, and they seem to be stacking: if I put a:root_and_ a:livelayout it (with<%= @inner_content %>) I see them both.