arichard44
Is there a way to have a LiveComponent figure out what path to return to from context (e.g. when closing a modal)?
I have a LiveComponent that I want to be easily portable to different views. It’s a modal pop-up for creating a new user.
Imagine you’re at accounts/:name
You click to open the “user-add” modal, which does a push_patch to accounts/:name/user-add
When done adding the user, you want it to push_patch back to accounts/:name
But say you want to have this component in accounts/:name/edit as well, and, similarly, when done adding the user, have it return from accounts/:name/edit/user-add back to accounts/:name/edit
I can do this by giving the component an assigns variable called @return_path or something like that, but I’m wondering if there is a way where you don’t explicitly have to set the assigns with this variable, and maybe the component can figure out from context which path it was called from and then just return to that path when closing.
First Post!
LostKobrakai
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
- #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









