-
-
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
[3.17] WillDestroy not called after a component is destroyed if that component was rendered from adding items to a list #18797
[3.17] WillDestroy not called after a component is destroyed if that component was rendered from adding items to a list #18797
Comments
I just hit the same issue. @jakesjews - did you find a fix? If not, I'll have to downgrade to 3.16 because that's a major problem for us. |
@boris-petrov unfortunately I have not. I downgraded our app to 3.16. |
Same problem here |
Same problem here, too. I went crazy with this :-). I'm downgrading to 3.16.3. |
Yeah, sorry about this y'all. Recent changes have this fixed and released in v3.17.2. |
I think I still have a problem with when My application has a list that is no longer rendered after the last element is removed:
There is logic outside of this template to add and remove items to the In 3.16.6
In 3.17.1
In 3.17.2
|
I can confirm the observation here, and this is still happening in Ember 3.18! You can see this very well in the Ember inspector. See the following debugging experiment, captured from an actual app: The field "rafters count" represents the length of the array being iterated over. The grey buttons are what is rendered in the each loop for each item. And on the right you see the matching component instances ( In the actual use case where this came up, the @rwjblue sorry, but I think this needs to be reopened! |
@simonihmig can you confirm that this still happens in v3.18.1, after #18941 was merged? |
Ya, there is also another issue fixed WRT rerenders within an |
@waissbluth Oh, great catch! I though we were already on the latest stable release 🤦♂️. So yes, works as expected again! Sorry for the noise here! |
Awesome, thanks for confirming that it is fixed! |
If a component is rendered for each item in an each block then any components created by adding new items to the bound list will not call their willDestroy hooks. The issue affects both classic and glimmer components.
The bug is demonstrated at https://github.com/jakesjews/ember-will-destroy-bug/blob/master/tests/integration/components/test-comp-test.js. The console logs whenever each component is created or destroyed. The first test logs out two creates and two destroys which is expected but the second test logs two creates and only one destroy.
The text was updated successfully, but these errors were encountered: