Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

javascript destroyed callback is called twice #3623

Open
rapidfsub opened this issue Jan 10, 2025 · 1 comment
Open

javascript destroyed callback is called twice #3623

rapidfsub opened this issue Jan 10, 2025 · 1 comment

Comments

@rapidfsub
Copy link

rapidfsub commented Jan 10, 2025

Environment

  • Elixir version (elixir -v): Elixir 1.18.1 (compiled with Erlang/OTP 27)
  • Phoenix version (mix deps): 1.7.18
  • Phoenix LiveView version (mix deps): 1.0.2
  • Operating system: macos sequoia 15.1.1
  • Browsers you attempted to reproduce this bug on (the more the merrier): firefox
  • Does the problem persist after removing "assets/node_modules" and trying again? Yes/no: yes

Actual behavior

In this example there are two liveviews, HomeLive and DummyLive.
In HomeLive, there are two buttons To dummy and Toggle.

  • How to reproduce
  1. open "http://localhost:4000" in browser
  2. open javascript console
  3. click Toggle button, then "mounted" will be printed in js console
  4. close the modal, then "destroyed" will be printed
  5. click To dummy, then "destroyed" will be printed (only in develop branch)

Expected behavior

I think the destroyed callback should not be called twice.
Is this a bug?

@TylerWitt
Copy link

Beyond this, using your example, if you toggle the modal open and closed 6 times, the navigate triggers 6 destroyed callbacks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants