Ensure first iteration of performAnimationWork loop has right priority
I don't think this actually changes any behavior because of the way findNextUnitOfWork works, but I think this is easier to follow.
Andrew Clark committed
Oct 28, 2016 at 10:58 UTC
ab920970aed771e3e39332aa7e5417845e80101d
1 file changed
+5
-6
src/renderers/shared/fiber/ReactFiberScheduler.js
+5
-6
@@ -425,17 +425,16 @@ module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) {
425
// Always start from the root
426
nextUnitOfWork = findNextUnitOfWork();
427
while (nextUnitOfWork &&
428
- nextPriorityLevel !== NoWork) {
428
+ nextPriorityLevel !== NoWork &&
429
+ nextPriorityLevel <= AnimationPriority) {
430
nextUnitOfWork = performUnitOfWork(nextUnitOfWork, false);
431
if (!nextUnitOfWork) {
432
// Keep searching for animation work until there's no more left
433
nextUnitOfWork = findNextUnitOfWork();
434
}
434
- // Stop if the next unit of work is low priority
435
- if (nextPriorityLevel > AnimationPriority) {
436
- scheduleDeferredCallback(performDeferredWork);
437
- return;
438
- }
435
+ }
436
+ if (nextUnitOfWork && nextPriorityLevel > AnimationPriority) {
437
+ scheduleDeferredCallback(performDeferredWork);
438
}
439
}
440