Here https://hexdocs.pm/phoenix_live_view/Phoenix.Component.html#link/1 is stated that " It is only possible to navigate between LiveViews declared under the same router
Phoenix.LiveView.Router.html#live_session/3. Otherwise, a full browser redirect is used."
What should be the behavior when there’s no
live_session declared in the router?
Because as far as my testing goes, the navigation (without full reload) works without the
live_session. Is the info that there’s one global
live_session by default just missing from the docs or am I completely confused?
Minimal repo to reproduce: GitHub - stefanluptak/navigate_without_live_session - start the server and go to
Thanks a lot.
Yeah we never introduced
live_session in our app and live navigation works perfectly
Live session is not about navigation. Its about protecting resources as far as i know. If you authenticate the user on first mounted liveview, and then navigate to other liveviews, the user will not be checked again and the user data from the first mount will be used. Live session makes sure the session gets checked on each new mounted liveview that is part of the same live session. I’ve used the example with user data but this can be applied to any check you want to make on mounting each liveview
EDIT: actually, i think im wrong, as reading this Live sessions in action · The Phoenix Files article, they say that when navigating to new root liveview a http request is made and this is fixed with livesession. So your question stands and my answer is just a specific detail in the story
I think my question is answered by the docs updated by the PR above.