-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(ngAnimate): only buffer rAF requests within the animation runners #12619
Conversation
…rame are buffered
@ThomasBurleson @AdriVanHoudt @MichhDiego this should fix the issues you guys are having. |
@IgorMinar please review. |
|
||
$animate.flush(); | ||
$rootScope.$digest(); |
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.
why do we need the extra digest after flush? it wasn't necessary before and we digest just before flushing already.
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.
So beforehand what happened was:
https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js#L782
triggerCallbacks()
issued a$$rAF.flush()
internally when called.triggerCallbacks()
also calls$timeout.flush(0)
which calls a digest somewhere down the line.
But with the changes to use $animate.flush()
we end up having to do this:
$animate.flush()
clears out the RAF for the runner.$rootScope.$digest()
allows for the resolved promise to flush (which can only be done after the RAF has flushed).
So we need to call RAF + digest always.
the rest looks good. thanks! |
thank you so much 👏 |
Closed with dc48aad |
Closes #12280
Here are demos to show that this works (test in IE):
Multiple RAF Requests in Angular 1.4 (#11791)
Material Design $$rAF perf issue (#12280)