Skip to content

Commit 2780e6f

Browse files
acdlitekoto
authored andcommitted
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 76ff7b2 commit 2780e6f

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

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

+6-5
Original file line numberDiff line numberDiff line change
@@ -334,15 +334,16 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes {
334334
// bother waiting until the root is complete.
335335
(wipLanes & suspendedLanes) === NoLanes
336336
) {
337-
getHighestPriorityLanes(wipLanes);
338-
const wipLanePriority = return_highestLanePriority;
337+
const nextLane = getHighestPriorityLane(nextLanes);
338+
const wipLane = getHighestPriorityLane(wipLanes);
339339
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 ||
341343
// Default priority updates should not interrupt transition updates. The
342344
// only difference between default updates and transition updates is that
343345
// default updates do not support refresh transitions.
344-
(nextLanePriority === DefaultLanePriority &&
345-
wipLanePriority === TransitionPriority)
346+
(nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes)
346347
) {
347348
// Keep working on the existing in-progress tree. Do not interrupt.
348349
return wipLanes;

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

+6-5
Original file line numberDiff line numberDiff line change
@@ -334,15 +334,16 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes {
334334
// bother waiting until the root is complete.
335335
(wipLanes & suspendedLanes) === NoLanes
336336
) {
337-
getHighestPriorityLanes(wipLanes);
338-
const wipLanePriority = return_highestLanePriority;
337+
const nextLane = getHighestPriorityLane(nextLanes);
338+
const wipLane = getHighestPriorityLane(wipLanes);
339339
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 ||
341343
// Default priority updates should not interrupt transition updates. The
342344
// only difference between default updates and transition updates is that
343345
// default updates do not support refresh transitions.
344-
(nextLanePriority === DefaultLanePriority &&
345-
wipLanePriority === TransitionPriority)
346+
(nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes)
346347
) {
347348
// Keep working on the existing in-progress tree. Do not interrupt.
348349
return wipLanes;

0 commit comments

Comments
 (0)