Skip to content

Commit df5a90b

Browse files
committed
No need to traverse to stopAt because it will break; anyway if it's consistent
Revert "Update only parents that may be inconsistent" This reverts commit 3a1aa3e.
1 parent 3a1aa3e commit df5a90b

File tree

2 files changed

+4
-24
lines changed

2 files changed

+4
-24
lines changed

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

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ export function popProvider(
142142
export function scheduleWorkOnParentPath(
143143
parent: Fiber | null,
144144
renderLanes: Lanes,
145-
stopAt?: Fiber | null = null,
146145
) {
147146
// Update the child lanes of all the ancestors, including the alternates.
148147
let node = parent;
@@ -161,11 +160,6 @@ export function scheduleWorkOnParentPath(
161160
} else {
162161
// Neither alternate was updated, which means the rest of the
163162
// ancestor path already has sufficient priority.
164-
if (stopAt === null) {
165-
break;
166-
}
167-
}
168-
if (stopAt && node === stopAt) {
169163
break;
170164
}
171165
node = node.return;
@@ -299,7 +293,7 @@ function propagateContextChange_eager<T>(
299293
) {
300294
// We don't know if it will have any context consumers in it.
301295
// Schedule this fiber as having work on its children.
302-
scheduleWorkOnParentPath(fiber.child, renderLanes, workInProgress);
296+
scheduleWorkOnParentPath(fiber.child, renderLanes);
303297
nextFiber = fiber.child;
304298
} else {
305299
// Traverse down.
@@ -387,11 +381,7 @@ function propagateContextChanges<T>(
387381
// on its children. We'll use the childLanes on
388382
// this fiber to indicate that a context has changed.
389383
const primaryChildFragment = workInProgress.child;
390-
scheduleWorkOnParentPath(
391-
primaryChildFragment,
392-
renderLanes,
393-
workInProgress,
394-
);
384+
scheduleWorkOnParentPath(primaryChildFragment, renderLanes);
395385
} else {
396386
scheduleWorkOnParentPath(consumer.return, renderLanes);
397387
}

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

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ export function popProvider(
142142
export function scheduleWorkOnParentPath(
143143
parent: Fiber | null,
144144
renderLanes: Lanes,
145-
stopAt?: Fiber | null = null,
146145
) {
147146
// Update the child lanes of all the ancestors, including the alternates.
148147
let node = parent;
@@ -161,11 +160,6 @@ export function scheduleWorkOnParentPath(
161160
} else {
162161
// Neither alternate was updated, which means the rest of the
163162
// ancestor path already has sufficient priority.
164-
if (stopAt === null) {
165-
break;
166-
}
167-
}
168-
if (stopAt && node === stopAt) {
169163
break;
170164
}
171165
node = node.return;
@@ -299,7 +293,7 @@ function propagateContextChange_eager<T>(
299293
) {
300294
// We don't know if it will have any context consumers in it.
301295
// Schedule this fiber as having work on its children.
302-
scheduleWorkOnParentPath(fiber.child, renderLanes, workInProgress);
296+
scheduleWorkOnParentPath(fiber.child, renderLanes);
303297
nextFiber = fiber.child;
304298
} else {
305299
// Traverse down.
@@ -387,11 +381,7 @@ function propagateContextChanges<T>(
387381
// on its children. We'll use the childLanes on
388382
// this fiber to indicate that a context has changed.
389383
const primaryChildFragment = workInProgress.child;
390-
scheduleWorkOnParentPath(
391-
primaryChildFragment,
392-
renderLanes,
393-
workInProgress,
394-
);
384+
scheduleWorkOnParentPath(primaryChildFragment, renderLanes);
395385
} else {
396386
scheduleWorkOnParentPath(consumer.return, renderLanes);
397387
}

0 commit comments

Comments
 (0)