@@ -142,6 +142,7 @@ export function popProvider(
142
142
export function scheduleWorkOnParentPath (
143
143
parent : Fiber | null ,
144
144
renderLanes : Lanes ,
145
+ stopAt ?: Fiber | null = null ,
145
146
) {
146
147
// Update the child lanes of all the ancestors, including the alternates.
147
148
let node = parent ;
@@ -160,6 +161,11 @@ export function scheduleWorkOnParentPath(
160
161
} else {
161
162
// Neither alternate was updated, which means the rest of the
162
163
// ancestor path already has sufficient priority.
164
+ if ( stopAt === null ) {
165
+ break ;
166
+ }
167
+ }
168
+ if ( stopAt && node === stopAt ) {
163
169
break ;
164
170
}
165
171
node = node.return;
@@ -285,15 +291,15 @@ function propagateContextChange_eager<T>(
285
291
// because we want to schedule this fiber as having work
286
292
// on its children. We'll use the childLanes on
287
293
// this fiber to indicate that a context has changed.
288
- scheduleWorkOnParentPath(parentSuspense, renderLanes);
294
+ scheduleWorkOnParentPath(parentSuspense, renderLanes, parentSuspense );
289
295
nextFiber = fiber.sibling;
290
296
} else if (
291
297
fiber . tag === SuspenseComponent &&
292
298
workInProgress . tag === ContextProvider
293
299
) {
294
300
// We don't know if it will have any context consumers in it.
295
301
// Schedule this fiber as having work on its children.
296
- scheduleWorkOnParentPath ( fiber . child , renderLanes ) ;
302
+ scheduleWorkOnParentPath ( fiber . child , renderLanes , fiber ) ;
297
303
nextFiber = fiber . child ;
298
304
} else {
299
305
// Traverse down.
@@ -381,7 +387,11 @@ function propagateContextChanges<T>(
381
387
// on its children. We'll use the childLanes on
382
388
// this fiber to indicate that a context has changed.
383
389
const primaryChildFragment = workInProgress . child ;
384
- scheduleWorkOnParentPath ( primaryChildFragment , renderLanes ) ;
390
+ scheduleWorkOnParentPath (
391
+ primaryChildFragment ,
392
+ renderLanes ,
393
+ workInProgress ,
394
+ ) ;
385
395
} else {
386
396
scheduleWorkOnParentPath ( consumer . return , renderLanes ) ;
387
397
}
@@ -425,7 +435,7 @@ function propagateContextChanges<T>(
425
435
// because we want to schedule this fiber as having work
426
436
// on its children. We'll use the childLanes on
427
437
// this fiber to indicate that a context has changed.
428
- scheduleWorkOnParentPath(parentSuspense, renderLanes);
438
+ scheduleWorkOnParentPath(parentSuspense, renderLanes, parentSuspense );
429
439
nextFiber = null;
430
440
} else {
431
441
// Traverse down.
0 commit comments