Skip to content

Commit 9241581

Browse files
committed
Use highest priority lane to detect interruptions
Instead of LanePriority. I'm removing all uses of LanePriority so I can delete it.
1 parent 148f8e4 commit 9241581

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
@@ -352,15 +352,16 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes {
352352
// bother waiting until the root is complete.
353353
(wipLanes & suspendedLanes) === NoLanes
354354
) {
355-
getHighestPriorityLanes(wipLanes);
356-
const wipLanePriority = return_highestLanePriority;
355+
const nextLane = getHighestPriorityLane(nextLanes);
356+
const wipLane = getHighestPriorityLane(wipLanes);
357357
if (
358-
nextLanePriority <= wipLanePriority ||
358+
// Tests whether the next lane is equal or lower priority than the wip
359+
// one. This works because the bits decrease in priority as you go left.
360+
nextLane >= wipLane ||
359361
// Default priority updates should not interrupt transition updates. The
360362
// only difference between default updates and transition updates is that
361363
// default updates do not support refresh transitions.
362-
(nextLanePriority === DefaultLanePriority &&
363-
wipLanePriority === TransitionPriority)
364+
(nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes)
364365
) {
365366
// Keep working on the existing in-progress tree. Do not interrupt.
366367
return wipLanes;

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,15 +352,16 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes {
352352
// bother waiting until the root is complete.
353353
(wipLanes & suspendedLanes) === NoLanes
354354
) {
355-
getHighestPriorityLanes(wipLanes);
356-
const wipLanePriority = return_highestLanePriority;
355+
const nextLane = getHighestPriorityLane(nextLanes);
356+
const wipLane = getHighestPriorityLane(wipLanes);
357357
if (
358-
nextLanePriority <= wipLanePriority ||
358+
// Tests whether the next lane is equal or lower priority than the wip
359+
// one. This works because the bits decrease in priority as you go left.
360+
nextLane >= wipLane ||
359361
// Default priority updates should not interrupt transition updates. The
360362
// only difference between default updates and transition updates is that
361363
// default updates do not support refresh transitions.
362-
(nextLanePriority === DefaultLanePriority &&
363-
wipLanePriority === TransitionPriority)
364+
(nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes)
364365
) {
365366
// Keep working on the existing in-progress tree. Do not interrupt.
366367
return wipLanes;

0 commit comments

Comments
 (0)