pelopo
Liveview default modal re-renders on cancel and clicking the 'back' button
I opened an issue in github on that, but I wonder what is the possible workaround.
out-of-the-box generated modal re-renders when closing modal and clicking ‘back’ on browser. The modal was generated by the default generator phx.gen.live Everything works fine, but the modal re-rendering get’s stuck in a loop when using the browser’s back button. See gif

I changed the default JS.navigate to JS.patch but nothing changed either.
P.S I’m very new to Phoenix. Here is my actual repo. it’s not one page, but it comes with a SQLite DB saved in github too, so should work as is. When in the app, click on the Analysis in the main menu and then select one of Countries, States, Cities, Territories List . They all have the same issue and were all generated with the default phx.gen.live Thanks
combobox repo
Marked As Solved
codeanpeace
If you’re testing the “show” LiveView for a single state record like in your screen recording, you need to update that LiveView instead of or in addition to the “index” LiveView for multiple state records. You’ll also want to update the modal core component with replace true too otherwise a duplicate entry will get added to the browser history when closing the modal.
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









