-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
fix(animations): don't consume instructions for animateChild #44357
fix(animations): don't consume instructions for animateChild #44357
Conversation
1dd744e
to
d0ebfe2
Compare
I just wanted to give some context for the reason for this change See this stackblitz, if you try transitioning between One and Two you'll see that two elements are incorrectly being shown, you can also see that the The issue here is that The real problem comes from the fact that the ignored player's callbacks do not get triggered, and that prevents the angular/packages/animations/browser/src/render/transition_animation_engine.ts Lines 1748 to 1751 in 155742e
angular/packages/animations/browser/src/render/transition_animation_engine.ts Lines 248 to 250 in 155742e
angular/packages/animations/browser/src/render/transition_animation_engine.ts Lines 1187 to 1191 in 155742e
skipped players still trigger their callbacks/cleanups without effecting the animation: angular/packages/animations/browser/src/render/transition_animation_engine.ts Lines 1217 to 1226 in 155742e
the only downside I can see here is that we end up with more players (even though skipped) in the animations' flush (as you can see from the updated unit tests), which I don't think makes much of a difference, and it does make sense because those players do exist and get skipped (from a user perspective, I don't think extra callbacks are called as those players are not associated with triggers, so there shouldn't be much of a difference there too) |
d0ebfe2
to
a62a63e
Compare
I just noticed that this change also fixes #30693 which looks very broken in the current state 🙂 |
a62a63e
to
71e8883
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love that this fixes the two bugs. I think we just need some additional code comments and variable name updates to help clarify what's happening here.
packages/core/test/animation/animation_query_integration_spec.ts
Outdated
Show resolved
Hide resolved
packages/core/test/animation/animation_query_integration_spec.ts
Outdated
Show resolved
Hide resolved
packages/core/test/animation/animation_query_integration_spec.ts
Outdated
Show resolved
Hide resolved
@jessicajaniuk thanks a lot for having a look at this!!!! 😍 I didn't add names to the players in the tests as they are sort of throw-away players (they are indeed skipped), but I do agree that it would be much nicer and clearer to give them more meaning and context, especially for someone reading the tests in the future I'll fix it, thanks 🙂👍 |
TODO: Fill body commit if PR gets accepted resolves angular#41483 resolves angular#30693
66fedeb
to
b47f176
Compare
@jessicajaniuk I've renamed the players and added comments before them explaining the acronyms, I hope this is ok (hopefully I am not being too verbose? 😓) please have another look and tell me what you think 🙂 |
b47f176
to
5295a9f
Compare
expect(p2p.element.classList.contains('parent2')).toBeTruthy(); | ||
expect(p2cp.element.classList.contains('child')).toBeTruthy(); | ||
expect(p1p.element.classList.contains('parent1')).toBeTruthy(); | ||
expect(p1cp.element.classList.contains('child')).toBeTruthy(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this last classList
wasn't being checked 🤔 , I've added the check for good measures 🙂
// - ( the player for the child animation executed by parent via query | ||
// and animateChild is skipped entirely ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this skipping/ignoring doesn't convince me, it may cause similar issues of missed cleanup calls 🤔 , I think that if/after this PR gets merged we should also look into this one and check if everything is ok 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🍪
Thanks for adding all the additional comments and clarifications here. I think it makes a big difference!
reviewed-for: fw-core, fw-animations
@jessicajaniuk sorry if it's a bit last minute 😅, I realized that it would be good to a unit test for this functionality, are you ok with us merging this PR now and me adding the unit test in a separate one? 🙂 |
This PR was merged into the repository by commit 38ddae1. |
Yup! :) |
add new unit test to make sure that leaving elements queried via a parent queried via animateChild are correctly removed this tests the fix introduced in PR angular#44357
add a new unit test to make sure that leaving elements queried via a parent queried via animateChild are correctly removed note: this tests the fix introduced in PR angular#44357
…#44357) TODO: Fill body commit if PR gets accepted resolves angular#41483 resolves angular#30693 PR Close angular#44357
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
resolves #41483
resolves #30693
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #41483 (also #30693)
Animations which include
animateChild
calls can fail to remove elements from the DOM as their players are ignored since they are unnecessary for the actual animationsWhat is the new behavior?
The aforementioned players are handled as skipped instead of ignoring them, making their callbacks/cleanups take place and removing the issue of not removing elements from the DOM
Does this PR introduce a breaking change?