live_render the LiveView module from the normal component (so I can remove they layouts):
def list(conn, _params) do
conn
|> put_root_layout(false)
|> put_layout(false)
|> live_render(AppWeb.NotificationsLiveList, session: %{
...
})
end
In the AppWeb.NotificationsLiveList, the mount function does what it needs (assigns some values, etc).
The content will be displayed correctly, but it seems that I cannot use phx-click (and others) from that HTML/HEEx. Why?
I see that the whole content is in LiveView <div> with all the necessary session info.
my guess is that by using put_root_layout(false) you are not loading root.html.heex which in turn loads app.js which probably attaches the event listeners.
on a related note, do you need jquery? most devs around here seem to prefer https://alpinejs.dev/ for jquery-like trickery including modals, and it plays nicely with phoenix.
Yeah, I’ve just found out that this put_root_layout is problematic. Thanks!
Do I really need jquery? Most likely not. I would assume that as some point I will remove it or replace it with something different, but for now - I’m using it in some places.