@samitouri / QOS-React-2 / commits / 4a99c5c3a7

Use highest priority lane to detect interruptions (#21088)

Instead of LanePriority. I'm removing all uses of LanePriority so I can delete it.

Andrew Clark committed Mar 25, 2021 at 11:36 UTC 4a99c5c3a780d8178d9278c29d0b7f44be6a0dce
2 files changed +12 -10
packages/react-reconciler/src/ReactFiberLane.new.js
+6 -5
@@ -334,15 +334,16 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes {
334 // bother waiting until the root is complete.
335 (wipLanes & suspendedLanes) === NoLanes
336 ) {
337 - getHighestPriorityLanes(wipLanes);
338 - const wipLanePriority = return_highestLanePriority;
337 + const nextLane = getHighestPriorityLane(nextLanes);
338 + const wipLane = getHighestPriorityLane(wipLanes);
339 if (
340 - nextLanePriority <= wipLanePriority ||
340 + // Tests whether the next lane is equal or lower priority than the wip
341 + // one. This works because the bits decrease in priority as you go left.
342 + nextLane >= wipLane ||
343 // Default priority updates should not interrupt transition updates. The
344 // only difference between default updates and transition updates is that
345 // default updates do not support refresh transitions.
344 - (nextLanePriority === DefaultLanePriority &&
345 - wipLanePriority === TransitionPriority)
346 + (nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes)
347 ) {
348 // Keep working on the existing in-progress tree. Do not interrupt.
349 return wipLanes;
packages/react-reconciler/src/ReactFiberLane.old.js
+6 -5
@@ -334,15 +334,16 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes {
334 // bother waiting until the root is complete.
335 (wipLanes & suspendedLanes) === NoLanes
336 ) {
337 - getHighestPriorityLanes(wipLanes);
338 - const wipLanePriority = return_highestLanePriority;
337 + const nextLane = getHighestPriorityLane(nextLanes);
338 + const wipLane = getHighestPriorityLane(wipLanes);
339 if (
340 - nextLanePriority <= wipLanePriority ||
340 + // Tests whether the next lane is equal or lower priority than the wip
341 + // one. This works because the bits decrease in priority as you go left.
342 + nextLane >= wipLane ||
343 // Default priority updates should not interrupt transition updates. The
344 // only difference between default updates and transition updates is that
345 // default updates do not support refresh transitions.
344 - (nextLanePriority === DefaultLanePriority &&
345 - wipLanePriority === TransitionPriority)
346 + (nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes)
347 ) {
348 // Keep working on the existing in-progress tree. Do not interrupt.
349 return wipLanes;