silverdr
Getting out of LiveView on disconnected render
There is a LiveView page with live route to it. All works fine. Now, during the “disconnected” phase, I would like to make a decision whether to continue with connected phase or bail out early to – for example – DeadView 404 handler. I know I could probably add a plug and pass that route through a dedicated pipeline, but since it’s a specific, isolated case, I am not too eager to go that path. Any other methods come to your head, maybe? Maybe a method to get hold of the initial conn somehow?
Marked As Solved
LostKobrakai
Stoping with an error from within a LV is done by raising an exception, which can be handled by Plug.Exception.
Also Liked
LostKobrakai
If you raise an error in mount/3 or the initial handle_params/3 of the static render it can be handled by the plug pipeline and never reach a place where the js client is booted up. So there are options before it‘s to late and indeed http becomes no longer the layer to error on.
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
- #hex









