@samitouri / QOS-React / commits / fd907c1f15

Re-land "Use highest priority lane to detect interruptions (#21088)""

This re-lands commit b4044f8a07323bcad7d55cbaedc35c35b4acf7e0.

Andrew Clark committed May 3, 2021 at 13:34 UTC fd907c1f153958950ba48db758cbd826d1e1af53
2 files changed +12 -10
packages/react-reconciler/src/ReactFiberLane.new.js
+6 -5
@@ -301,15 +301,16 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes {
301 // bother waiting until the root is complete.
302 (wipLanes & suspendedLanes) === NoLanes
303 ) {
304 - getHighestPriorityLanes(wipLanes);
305 - const wipLanePriority = return_highestLanePriority;
304 + const nextLane = getHighestPriorityLane(nextLanes);
305 + const wipLane = getHighestPriorityLane(wipLanes);
306 if (
307 - nextLanePriority <= wipLanePriority ||
307 + // Tests whether the next lane is equal or lower priority than the wip
308 + // one. This works because the bits decrease in priority as you go left.
309 + nextLane >= wipLane ||
310 // Default priority updates should not interrupt transition updates. The
311 // only difference between default updates and transition updates is that
312 // default updates do not support refresh transitions.
311 - (nextLanePriority === DefaultLanePriority &&
312 - wipLanePriority === TransitionPriority)
313 + (nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes)
314 ) {
315 // Keep working on the existing in-progress tree. Do not interrupt.
316 return wipLanes;
packages/react-reconciler/src/ReactFiberLane.old.js
+6 -5
@@ -301,15 +301,16 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes {
301 // bother waiting until the root is complete.
302 (wipLanes & suspendedLanes) === NoLanes
303 ) {
304 - getHighestPriorityLanes(wipLanes);
305 - const wipLanePriority = return_highestLanePriority;
304 + const nextLane = getHighestPriorityLane(nextLanes);
305 + const wipLane = getHighestPriorityLane(wipLanes);
306 if (
307 - nextLanePriority <= wipLanePriority ||
307 + // Tests whether the next lane is equal or lower priority than the wip
308 + // one. This works because the bits decrease in priority as you go left.
309 + nextLane >= wipLane ||
310 // Default priority updates should not interrupt transition updates. The
311 // only difference between default updates and transition updates is that
312 // default updates do not support refresh transitions.
311 - (nextLanePriority === DefaultLanePriority &&
312 - wipLanePriority === TransitionPriority)
313 + (nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes)
314 ) {
315 // Keep working on the existing in-progress tree. Do not interrupt.
316 return wipLanes;