Skip to content

Commit

Permalink
Re-land "Use highest priority lane to detect interruptions (facebook#…
Browse files Browse the repository at this point in the history
…21088)""

This re-lands commit b4044f8.
  • Loading branch information
acdlite committed May 3, 2021
1 parent 79740da commit fd907c1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
11 changes: 6 additions & 5 deletions packages/react-reconciler/src/ReactFiberLane.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,16 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes {
// bother waiting until the root is complete.
(wipLanes & suspendedLanes) === NoLanes
) {
getHighestPriorityLanes(wipLanes);
const wipLanePriority = return_highestLanePriority;
const nextLane = getHighestPriorityLane(nextLanes);
const wipLane = getHighestPriorityLane(wipLanes);
if (
nextLanePriority <= wipLanePriority ||
// Tests whether the next lane is equal or lower priority than the wip
// one. This works because the bits decrease in priority as you go left.
nextLane >= wipLane ||
// Default priority updates should not interrupt transition updates. The
// only difference between default updates and transition updates is that
// default updates do not support refresh transitions.
(nextLanePriority === DefaultLanePriority &&
wipLanePriority === TransitionPriority)
(nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes)
) {
// Keep working on the existing in-progress tree. Do not interrupt.
return wipLanes;
Expand Down
11 changes: 6 additions & 5 deletions packages/react-reconciler/src/ReactFiberLane.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,16 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes {
// bother waiting until the root is complete.
(wipLanes & suspendedLanes) === NoLanes
) {
getHighestPriorityLanes(wipLanes);
const wipLanePriority = return_highestLanePriority;
const nextLane = getHighestPriorityLane(nextLanes);
const wipLane = getHighestPriorityLane(wipLanes);
if (
nextLanePriority <= wipLanePriority ||
// Tests whether the next lane is equal or lower priority than the wip
// one. This works because the bits decrease in priority as you go left.
nextLane >= wipLane ||
// Default priority updates should not interrupt transition updates. The
// only difference between default updates and transition updates is that
// default updates do not support refresh transitions.
(nextLanePriority === DefaultLanePriority &&
wipLanePriority === TransitionPriority)
(nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes)
) {
// Keep working on the existing in-progress tree. Do not interrupt.
return wipLanes;
Expand Down

0 comments on commit fd907c1

Please sign in to comment.