new lifecycle onAfterUnmount
#510
Closed
Alfred-Skyblue
started this conversation in
RFC Discussions
Replies: 1 comment 2 replies
-
I believe we shouldn’t manually remove elements that are created by Vue. What is the use case for this? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When we remove an element using
el.remove()
, the components contained within that element do not execute theonUnmounted
lifecycle. I would like to add a new lifecycle calledonAfterUnmounted
that triggers after the component'sel
or the element containing the current component is removed from the DOM tree. Otherwise, when we manually remove DOM elements, it causes memory leaks in the child components contained within that element.demo
In the demo above, we demonstrate the usage scenario where
onUnmounted
is not triggered when we useel.remove()
to delete elements.PR
Beta Was this translation helpful? Give feedback.
All reactions