-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
in-element
helper doesn't fire destroy hooks on children when destinationElement is removed from DOM
#20710
Comments
I've found a similar lifecycle issue for modifiers when conditionally rendered, and have repro steps in the issue reported to ember-modifier: ember-modifier/ember-modifier#613 Unsure if it's related, but wanted to call it out in case they are |
the moment |
Regardless of what Ember's internal virtual DOM thinks, the actual DOM elements get removed when the destination element is removed from the DOM. This leads to crashes when referencing those elements. Since the modifier API is specifically designed to give you references to DOM elements and not Ember's internal virtual DOM representations, it's easy to write these kinds of crashes when using Ember. |
I updated the Glimdown reproduction to use entirely Glimmer Components The problem still exists. The workaround for now is to duplicate the |
🐞 Describe the Bug
If there are elements nested inside an
in-element
helper, they get rendered to a remote element defined bydestinationElement
. If this remote element is removed from the DOM, the elements nested inside thein-element
helper are destroyed. However, their destroy hooks are not triggered.This can cause leakage and stale reference exceptions to occur, because modifier and component destroy hooks did not get a chance to do cleanup.
🔬 Minimal Reproduction
Glimdown reproduction
😕 Actual Behavior
🤔 Expected Behavior
🌍 Environment
The text was updated successfully, but these errors were encountered: