Skip to content

Listeners are not updated correctly on component reuse #7579

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

Closed
xiaodemen opened this issue Jan 31, 2018 · 2 comments
Closed

Listeners are not updated correctly on component reuse #7579

xiaodemen opened this issue Jan 31, 2018 · 2 comments
Labels

Comments

@xiaodemen
Copy link
Contributor

Version

2.5.13

Reproduction link

https://jsfiddle.net/x78pz6u1/7/

Steps to reproduce

  1. click emit1, alert something, no problem.
  2. click switch.
  3. click emit2, alert again, not expected!

What is expected?

not alert when I click the button emit2

What is actually happening?

alert when I click the button emit2


not considering the edge case: listeners are removed on component reuse.
perhaps a bug at line 260 in v2.5.13/src/core/instance/lifecycle.js

@posva
Copy link
Member

posva commented Jan 31, 2018

Looks like the reused component is keeping the event listeners.
As a workaround for the moment, add a key attribute on one of the components

@posva posva added the bug label Jan 31, 2018
@posva
Copy link
Member

posva commented Jan 31, 2018

Checking with git version, looks like it was already fixed. But thanks for reporting it 🙂
edit: Duplicate of #7294

@posva posva closed this as completed Jan 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants