@samitouri / QOS-React-2 / commits / b72c27ce5d

Don't schedule NoWork as the next work

We currently only filter out "NoWork" in the beginning of this function. If the NoWork root is after the one with work it will show up in the second loop. There's probably a more efficient way of doing this but this works for now. This showed up in this PR because a new unit test gets unblocked which ends up with this case.

Sebastian Markbage committed Oct 20, 2016 at 11:46 UTC b72c27ce5de4900af544e542774744601f6f1d62
1 file changed +3 -4
src/renderers/shared/fiber/ReactFiberScheduler.js
+3 -4
@@ -79,14 +79,13 @@ module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) {
79 }
80 nextScheduledRoot = nextScheduledRoot.nextScheduledRoot;
81 }
82 - // TODO: This is scanning one root at a time. It should be scanning all
83 - // roots for high priority work before moving on to lower priorities.
82 let root = nextScheduledRoot;
83 let highestPriorityRoot = null;
84 let highestPriorityLevel = NoWork;
85 while (root) {
88 - if (highestPriorityLevel === NoWork ||
89 - highestPriorityLevel > root.current.pendingWorkPriority) {
86 + if (root.current.pendingWorkPriority !== NoWork && (
87 + highestPriorityLevel === NoWork ||
88 + highestPriorityLevel > root.current.pendingWorkPriority)) {
89 highestPriorityLevel = root.current.pendingWorkPriority;
90 highestPriorityRoot = root;
91 }