revati
About attach_hook/4 after callback
Curently it supports :mount, :handle_params, :handle_event , and :handle_info and they are executed before main live view callback. Its all fine for cases, when one needs to validate/authenticate and so on, but if i need to do something after every handle_params, (to calculate active menu page, or just load extra data after main base bulk is loaded) i need to call it manually from every handle_params live view callback.
It would be nice if :mount, :handle_params, :handle_event , and :handle_info would also have after counterparts, for those cases.
Are there some mayor drawbacks for such approach?
How would you do it while there isnt such after hooks?
Most Liked
cmo
I find the assigning of nav and page title relevant to the page and/or data, so I have those functions in each liveview. Sometimes it is simply assigning constants and others it is more context aware. There is no context switching involved which I’m a fan of.
I’m not super keen on having something defined at the top of the file that will then change the output of functions down below ![]()
Popular in Discussions
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
- #javascript
- #code-sync
- #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








