sabo66
Avoid "tab effect browser reloading" with live navigate?
Hello, I’m starting with Phoenix and live navigation, it is possible to avoid the “reload effect” of the tab browser ? Like on Twitter for exemple, or I need to use some AJAX ?
Marked As Solved
sabo66
It was indeed a Javascript problem, app.js was not loaded correctly ![]()
Also Liked
sodapopcan
Ah yes, if you are going to be navigating from a controller to a LiveView then you’re going to get the reload. There is no simple way around that that I know of. I think using AJAX would even be complicated based on how LiveView works (it first makes an HTTP request then upgrades to a websocket). I think your best bet would be to make UserController a LiveView and stick it under the live_session. That’s the extent of what I know unless anyone else can chime in. Sorry I couldn’t be of more help!
sodapopcan
You mean tab navigation? (sorry, I don’t know Twitter very well).
Take a look at live navigation in the guides as well as the docs for push_patch/2.
live_session/3 might also be of interest. If not now it will be soon enough!
sodapopcan
If you are navigating within the same LiveView then you can use <.link patch={~p"/route"}>...</.link>. If you are navigating to a different LiveView that is under the same live session, then you use <.link redirect={~p"/route"}>...</.link> which will happen in the same websocket connection and the browser won’t reload.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









