This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(ngAnimate): ensure nested class-based animations are spaced out with a RAF #11907
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87acec9
to
e5e1ec1
Compare
e5e1ec1
to
4d2a1a8
Compare
@@ -53,12 +57,18 @@ var $$AnimationProvider = ['$animateProvider', function($animateProvider) { | |||
options.tempClasses = null; | |||
} | |||
|
|||
var classBasedIndex; | |||
if (!isStructural) { | |||
classBasedIndex = totalPendingClassBasedAnimations++; |
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.
Despite lack of brevity I think it is safer to make this explicit:
classBasedIndex = totalPendingClassBasedAnimations;
totalPendingClassBasedAnimations += 1;
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.
👍
The ++
syntax looks a little magical, it's easy to make a mistake.
|
I confirm it does fix the real issue in my app that I reduced to #11812 👍 |
@petebacondarwin yes we need tests for it. I'll do those in the morning tomorrow. |
…ith a RAF Prior to this fix any nested class-based animations (animations that are triggered with addClass/removeClass or ngClass) would cancel each other out when nested in DOM structure. This fix ensures that the nested animations are spaced out with sequenced RAFs so that parent CSS classes are applied prior to any ancestor animations that are scheduled to run. Closes angular#11812
4d2a1a8
to
2da33f6
Compare
@petebacondarwin @mzgol the code has been fixed and the tests have been added. |
Merged as 213c2a7 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prior to this fix any nested class-based animations (animations that are
triggered with addClass/removeClass or ngClass) would cancel each other
out when nested in DOM structure. This fix ensures that the nested
animations are spaced out with sequenced RAFs so that parent CSS classes
are applied prior to any ancestor animations that are scheduled to run.
Closes #11812