Skip to content

Commit

Permalink
No need to traverse to stopAt because it will break; anyway if it…
Browse files Browse the repository at this point in the history
…'s consistent

Revert "Update only parents that may be inconsistent"

This reverts commit 3a1aa3e.
  • Loading branch information
okmttdhr committed Jan 17, 2022
1 parent 3a1aa3e commit df5a90b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
14 changes: 2 additions & 12 deletions packages/react-reconciler/src/ReactFiberNewContext.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ export function popProvider(
export function scheduleWorkOnParentPath(
parent: Fiber | null,
renderLanes: Lanes,
stopAt?: Fiber | null = null,
) {
// Update the child lanes of all the ancestors, including the alternates.
let node = parent;
Expand All @@ -161,11 +160,6 @@ export function scheduleWorkOnParentPath(
} else {
// Neither alternate was updated, which means the rest of the
// ancestor path already has sufficient priority.
if (stopAt === null) {
break;
}
}
if (stopAt && node === stopAt) {
break;
}
node = node.return;
Expand Down Expand Up @@ -299,7 +293,7 @@ function propagateContextChange_eager<T>(
) {
// We don't know if it will have any context consumers in it.
// Schedule this fiber as having work on its children.
scheduleWorkOnParentPath(fiber.child, renderLanes, workInProgress);
scheduleWorkOnParentPath(fiber.child, renderLanes);
nextFiber = fiber.child;
} else {
// Traverse down.
Expand Down Expand Up @@ -387,11 +381,7 @@ function propagateContextChanges<T>(
// on its children. We'll use the childLanes on
// this fiber to indicate that a context has changed.
const primaryChildFragment = workInProgress.child;
scheduleWorkOnParentPath(
primaryChildFragment,
renderLanes,
workInProgress,
);
scheduleWorkOnParentPath(primaryChildFragment, renderLanes);
} else {
scheduleWorkOnParentPath(consumer.return, renderLanes);
}
Expand Down
14 changes: 2 additions & 12 deletions packages/react-reconciler/src/ReactFiberNewContext.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ export function popProvider(
export function scheduleWorkOnParentPath(
parent: Fiber | null,
renderLanes: Lanes,
stopAt?: Fiber | null = null,
) {
// Update the child lanes of all the ancestors, including the alternates.
let node = parent;
Expand All @@ -161,11 +160,6 @@ export function scheduleWorkOnParentPath(
} else {
// Neither alternate was updated, which means the rest of the
// ancestor path already has sufficient priority.
if (stopAt === null) {
break;
}
}
if (stopAt && node === stopAt) {
break;
}
node = node.return;
Expand Down Expand Up @@ -299,7 +293,7 @@ function propagateContextChange_eager<T>(
) {
// We don't know if it will have any context consumers in it.
// Schedule this fiber as having work on its children.
scheduleWorkOnParentPath(fiber.child, renderLanes, workInProgress);
scheduleWorkOnParentPath(fiber.child, renderLanes);
nextFiber = fiber.child;
} else {
// Traverse down.
Expand Down Expand Up @@ -387,11 +381,7 @@ function propagateContextChanges<T>(
// on its children. We'll use the childLanes on
// this fiber to indicate that a context has changed.
const primaryChildFragment = workInProgress.child;
scheduleWorkOnParentPath(
primaryChildFragment,
renderLanes,
workInProgress,
);
scheduleWorkOnParentPath(primaryChildFragment, renderLanes);
} else {
scheduleWorkOnParentPath(consumer.return, renderLanes);
}
Expand Down

0 comments on commit df5a90b

Please sign in to comment.