-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(ngAnimate): $timeout without invokeApply #12282
Conversation
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
resolves #12281 I have signed the cla |
This change calls $timeout with the invokeApply parameter set to false which stops ngAnimate from invoking its changes inside an $apply block
6d909fd
to
594f36e
Compare
CLAs look good, thanks! |
This looks like a good change to me, but probably needs another pair of eyes to be sure. |
+1 thanks |
There are plunkrs that demo this bug on #12281 |
solid change +1 |
@wesleycho the $timeout definitely shouldn't be forcing an apply but the original code doesn't make total sense to me. So I agree it needs another set of eyes. The $timeout queues up onAnimationExpired() to run after a given time period but then says in the code comments the below.
A reference to the $timeout isn't stored and cancelled if the animation is successful in onAnimationProgress(). So the $timedout function onAnimationExpired() runs for every element regardless of where its failed or not. So it goes And then because of no invokeApply false passed to the timeout it does a full apply/digest cycle per element. If we do end up in the close() block and indeed the animation hasn't finished and we need to clean up the element for whatever reason this may necessitate a digest() (but im not sure). I put in the code below "// IF WE GET HERE MAYBE DIGEST ON THE SCOPE OF THE ELEMENT" where this should probably happen.
|
This is great. Thank you for finding this. |
Merged in now to master. Thanks again for finding this. |
This change calls $timeout with the invokeApply parameter set to false which stops ngAnimate from invoking its changes inside an $apply block Closes angular#12281 Closes angular#12282
This change calls $timeout with the invokeApply parameter set to false which stops ngAnimate from invoking its changes inside an $apply block Closes angular#12281 Closes angular#12282
Currently when using ngAnimate in-conjunction
with ng-repeat a $rootScope.$digest happens
per element animated.
This change calls $timeout with the invokeApply
parameter set to false which stops ngAnimate
from invoking its changes inside an $apply block.