Skip to content

the detached events not trigger #801

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
TerenceZ opened this issue Apr 21, 2015 · 3 comments
Closed

the detached events not trigger #801

TerenceZ opened this issue Apr 21, 2015 · 3 comments

Comments

@TerenceZ
Copy link

In the followed situations, some expected detached event(s) not fire:

  1. [v-if] > [v-repeat] > [template] > [v-component]: In this structure, if we make [v-if] false after dynamic adding more components, the detached event won't be fired on the added components. demo
  2. [v-repeat] > [template] > [v-component]: In this structure, if reduce the repeat items, it will destroy the redundant components. However it seems that it clears all detached events in _events before firing for the redundant components. It's worth noting that there are no problems for deeper components. demo

Test version: 0.11.5 ~ 0.11.7.

@yyx990803
Copy link
Member

Case 1 has been fixed in the transclude-refactor branch.

Case 2 is a bit different, because v-events and events option both only works when the instance is still active. When you set total=0, all instances are destroyed and the event listeners also. This also means it's not recommended to use the event system to listen to the internal lifecycle hooks.

@TerenceZ
Copy link
Author

Oh, I think it also means the component may be cleared when invoking the internal detached event. If so, it's worth documenting these in the guide.

@yyx990803
Copy link
Member

Closing (no actionable item regarding codebase)

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