-
-
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
Element modifier destruction broken in animated-if with Ember 3.17 #18795
Comments
I noticed a similar issue when using the Given two components, one using Component impl: export default class Foo extends Component {
_didInsert = (element) => {
console.log('glimmer', '{{did-insert}}', element, document.querySelector('#yield-bar'), document.querySelector('#outside-yield'));
}
_willDestroy = (element) => {
console.log('glimmer', '{{will-destroy}}', element, document.querySelector('#yield-bar'), document.querySelector('#outside-yield'));
}
willDestroy(){
console.log('glimmer', 'willDestroy', document.querySelector('#yield-bar'), document.querySelector('#outside-yield'));
}
} with their template: <div
{{did-insert this._didInsert}}
{{will-destroy this._willDestroy}}
>
<div>{{yield}}</div>
</div> and using them in an ember template:
I can see a different lifecycle of will-destroy: 3.17: 3.16: It seems like the (I know that one shouldn't query the DOM that way but there might be addons that rely on elements existing when |
@makepanic the change in destroy order there is actually expected. Classic components had used a different destruction queue before the VM upgrade which added a fair amount of complexity, and was actually unnecessary and took them out of the normal destruction flow (and ordering). The VM upgrade fixed this, and like you said folks shouldn't be relying on the ordering of |
Is there a hook for glimmer components to execute when it will destroy but is still in DOM? I noticed that basic-dropdown (maybe cc @cibernox ) (see template ) does manual DOM manipulation in the will-destroy modifier. There are probably others that will break with 3.17 so we might need to migrate them. |
@makepanic ah, sorry, I didn't read your comment closely enough. I thought you were discussing the ordering of the We've been discussing the modifier issue, there isn't a resolution just yet because the new behavior is actually what was spec'd in the original modifier RFC. But, the nature of modifiers implies they should have a |
This change is indeed surprising. The name |
Per the modifier manager RFC:
I think a lot of folks who were writing modifiers did not realize this, but it makes sense given what Modifiers, though, likely need a way to clean up before DOM removal given their purpose. In addition, the |
hmm... given the above, how does the or is the |
The element is still there, it has just been removed from the DOM. In many cases, this is all that is needed, like for instance with |
okay, thanks for the clarification. it looks like my issue above is slightly different though, because it seems that the |
Yes, absolutely. I haven't had a chance to dig in here, but I'm tracking and will be taking a look when I can. |
I also noticed this when trying to access |
I'm guessing this is related to #18855 (comment) |
@Turbo87 is it still an issue in 3.18/3.19? |
@andreyfel I'm seeing this with PaperMenu while upgrading to Ember 3.20. |
…will destroy element being fired. See emberjs/ember.js#18795
I concur this is still happening in 3.20. |
I know it is a bit outdated already but stumbled accross that when I was wondering if the willDestroy can be blocked for period of time. The That is a nice feature. It would be great to have a symmetrical operation that allows the teardown while still using the css to animate out. I would have liked to see that From a software development perspective it is not the cleanest approach (since you would need the animation duration in two places), but for the user experience it would be nice to use the inverse animation path by using the same CSS animation. |
see ember-animation/ember-animated#202
Since I'm not sure if the issue is in ember-animated or in the new Ember release I'm opening an issue here too.
The text was updated successfully, but these errors were encountered: