Using liveview as root layout

currently I have an application that uses liveview mostly. At the current moment I have popup menu with some other buttons that are handled in javascript. I wanted to refactor and change all the javascript with a liveview component.

The way I decided to move everything from app to a new liveview, and leave the app only as reference to liveview layout:
app.html.eex |> root_layout.html.leex |> other children layouts

Is there any downside to this approach? Or is it possible to refactor root layout to be liveview directly?

Hey, I’d would probably set up a root.html.eex, app.htlm.eex, and live.html.leex, as it was done in the live_view example app: . This works for phoenix_live_view v0.10.0.

This allows you to have both routes with and without LiveView (e.g. if you just need a static page at some point or the like.)

1 Like

This is what I currently have, this solves none of the problems. What I will end up doing most probably is to put multiple liveviews in root and allow communication between them via pubsub.