Skip to content

Commit f2d3e55

Browse files
committed
Use highest priority lane to detect interruptions (facebook#21088)
Instead of LanePriority. I'm removing all uses of LanePriority so I can delete it.
1 parent 1ba120a commit f2d3e55

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

packages/react-reconciler/src/ReactFiberLane.new.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,15 +342,16 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes {
342342
// bother waiting until the root is complete.
343343
(wipLanes & suspendedLanes) === NoLanes
344344
) {
345-
getHighestPriorityLanes(wipLanes);
346-
const wipLanePriority = return_highestLanePriority;
345+
const nextLane = getHighestPriorityLane(nextLanes);
346+
const wipLane = getHighestPriorityLane(wipLanes);
347347
if (
348-
nextLanePriority <= wipLanePriority ||
348+
// Tests whether the next lane is equal or lower priority than the wip
349+
// one. This works because the bits decrease in priority as you go left.
350+
nextLane >= wipLane ||
349351
// Default priority updates should not interrupt transition updates. The
350352
// only difference between default updates and transition updates is that
351353
// default updates do not support refresh transitions.
352-
(nextLanePriority === DefaultLanePriority &&
353-
wipLanePriority === TransitionPriority)
354+
(nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes)
354355
) {
355356
// Keep working on the existing in-progress tree. Do not interrupt.
356357
return wipLanes;

packages/react-reconciler/src/ReactFiberLane.old.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,15 +342,16 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes {
342342
// bother waiting until the root is complete.
343343
(wipLanes & suspendedLanes) === NoLanes
344344
) {
345-
getHighestPriorityLanes(wipLanes);
346-
const wipLanePriority = return_highestLanePriority;
345+
const nextLane = getHighestPriorityLane(nextLanes);
346+
const wipLane = getHighestPriorityLane(wipLanes);
347347
if (
348-
nextLanePriority <= wipLanePriority ||
348+
// Tests whether the next lane is equal or lower priority than the wip
349+
// one. This works because the bits decrease in priority as you go left.
350+
nextLane >= wipLane ||
349351
// Default priority updates should not interrupt transition updates. The
350352
// only difference between default updates and transition updates is that
351353
// default updates do not support refresh transitions.
352-
(nextLanePriority === DefaultLanePriority &&
353-
wipLanePriority === TransitionPriority)
354+
(nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes)
354355
) {
355356
// Keep working on the existing in-progress tree. Do not interrupt.
356357
return wipLanes;

0 commit comments

Comments
 (0)