File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
packages/react-reconciler/src Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -1169,15 +1169,15 @@ export function replayFunctionComponent(
11691169 nextProps : any ,
11701170 Component : any ,
11711171 renderLanes : Lanes ,
1172+ secondArg : any ,
11721173) : Fiber | null {
11731174 // This function is used to replay a component that previously suspended,
11741175 // after its data resolves. It's a simplified version of
11751176 // updateFunctionComponent that reuses the hooks from the previous attempt.
11761177
1177- let context ;
1178- if ( ! disableLegacyContext ) {
1178+ if ( ! disableLegacyContext && secondArg === undefined ) {
11791179 const unmaskedContext = getUnmaskedContext ( workInProgress , Component , true ) ;
1180- context = getMaskedContext ( workInProgress , unmaskedContext ) ;
1180+ secondArg = getMaskedContext ( workInProgress , unmaskedContext ) ;
11811181 }
11821182
11831183 prepareToReadContext ( workInProgress , renderLanes ) ;
@@ -1189,7 +1189,7 @@ export function replayFunctionComponent(
11891189 workInProgress ,
11901190 Component ,
11911191 nextProps ,
1192- context ,
1192+ secondArg ,
11931193 ) ;
11941194 const hasId = checkDidRenderIdHook ( ) ;
11951195 if ( enableSchedulingProfiler ) {
Original file line number Diff line number Diff line change @@ -2390,6 +2390,8 @@ function replaySuspendedUnitOfWork(unitOfWork: Fiber): void {
23902390 unitOfWork . tag === FunctionComponent
23912391 ? unitOfWork . type
23922392 : unitOfWork . type . render ;
2393+ const secondArg =
2394+ unitOfWork . tag === FunctionComponent ? undefined : unitOfWork . ref ;
23932395 const unresolvedProps = unitOfWork . pendingProps ;
23942396 const resolvedProps =
23952397 unitOfWork . elementType === Component
@@ -2401,18 +2403,21 @@ function replaySuspendedUnitOfWork(unitOfWork: Fiber): void {
24012403 resolvedProps ,
24022404 Component ,
24032405 workInProgressRootRenderLanes ,
2406+ secondArg ,
24042407 ) ;
24052408 break ;
24062409 }
24072410 case SimpleMemoComponent : {
24082411 const Component = unitOfWork . type ;
24092412 const nextProps = unitOfWork . pendingProps ;
2413+ const secondArg = undefined ;
24102414 next = replayFunctionComponent (
24112415 current ,
24122416 unitOfWork ,
24132417 nextProps ,
24142418 Component ,
24152419 workInProgressRootRenderLanes ,
2420+ secondArg ,
24162421 ) ;
24172422 break ;
24182423 }
You can’t perform that action at this time.
0 commit comments