diff --git a/packages/react-reconciler/src/ReactFiberBeginWork.new.js b/packages/react-reconciler/src/ReactFiberBeginWork.new.js index cdbb5352eaa6b..dd35d7764057b 100644 --- a/packages/react-reconciler/src/ReactFiberBeginWork.new.js +++ b/packages/react-reconciler/src/ReactFiberBeginWork.new.js @@ -2754,13 +2754,17 @@ function updateDehydratedSuspenseComponent( } } -function scheduleContextWorkOnFiber(fiber: Fiber, renderLanes: Lanes) { +function scheduleSuspenseWorkOnFiber(fiber: Fiber, renderLanes: Lanes) { fiber.lanes = mergeLanes(fiber.lanes, renderLanes); const alternate = fiber.alternate; if (alternate !== null) { alternate.lanes = mergeLanes(alternate.lanes, renderLanes); } - scheduleContextWorkOnParentPath(fiber.return, renderLanes, null); + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + fiber.return.return, + ); } function propagateSuspenseContextChange( @@ -2776,7 +2780,7 @@ function propagateSuspenseContextChange( if (node.tag === SuspenseComponent) { const state: SuspenseState | null = node.memoizedState; if (state !== null) { - scheduleContextWorkOnFiber(node, renderLanes); + scheduleSuspenseWorkOnFiber(node, renderLanes); } } else if (node.tag === SuspenseListComponent) { // If the tail is hidden there might not be an Suspense boundaries @@ -2784,7 +2788,7 @@ function propagateSuspenseContextChange( // list itself. // We don't have to traverse to the children of the list since // the list will propagate the change when it rerenders. - scheduleContextWorkOnFiber(node, renderLanes); + scheduleSuspenseWorkOnFiber(node, renderLanes); } else if (node.child !== null) { node.child.return = node; node = node.child; diff --git a/packages/react-reconciler/src/ReactFiberBeginWork.old.js b/packages/react-reconciler/src/ReactFiberBeginWork.old.js index 379245ebdfbc7..23ef764356ed5 100644 --- a/packages/react-reconciler/src/ReactFiberBeginWork.old.js +++ b/packages/react-reconciler/src/ReactFiberBeginWork.old.js @@ -2754,13 +2754,17 @@ function updateDehydratedSuspenseComponent( } } -function scheduleContextWorkOnFiber(fiber: Fiber, renderLanes: Lanes) { +function scheduleSuspenseWorkOnFiber(fiber: Fiber, renderLanes: Lanes) { fiber.lanes = mergeLanes(fiber.lanes, renderLanes); const alternate = fiber.alternate; if (alternate !== null) { alternate.lanes = mergeLanes(alternate.lanes, renderLanes); } - scheduleContextWorkOnParentPath(fiber.return, renderLanes, null); + scheduleContextWorkOnParentPath( + fiber.return, + renderLanes, + fiber.return.return, + ); } function propagateSuspenseContextChange( @@ -2776,7 +2780,7 @@ function propagateSuspenseContextChange( if (node.tag === SuspenseComponent) { const state: SuspenseState | null = node.memoizedState; if (state !== null) { - scheduleContextWorkOnFiber(node, renderLanes); + scheduleSuspenseWorkOnFiber(node, renderLanes); } } else if (node.tag === SuspenseListComponent) { // If the tail is hidden there might not be an Suspense boundaries @@ -2784,7 +2788,7 @@ function propagateSuspenseContextChange( // list itself. // We don't have to traverse to the children of the list since // the list will propagate the change when it rerenders. - scheduleContextWorkOnFiber(node, renderLanes); + scheduleSuspenseWorkOnFiber(node, renderLanes); } else if (node.child !== null) { node.child.return = node; node = node.child;