MCPcopy
hub / github.com/react/react / updateActivityComponent

Function updateActivityComponent

packages/react-reconciler/src/ReactFiberBeginWork.js:1121–1212  ·  view source on GitHub ↗
(
  current: null | Fiber,
  workInProgress: Fiber,
  renderLanes: Lanes,
)

Source from the content-addressed store, hash-verified

1119}
1120
1121function updateActivityComponent(
1122 current: null | Fiber,
1123 workInProgress: Fiber,
1124 renderLanes: Lanes,
1125) {
1126 const nextProps: ActivityProps = workInProgress.pendingProps;
1127
1128 // Check if the first pass suspended.
1129 const didSuspend = (workInProgress.flags & DidCapture) !== NoFlags;
1130 workInProgress.flags &= ~DidCapture;
1131
1132 if (current === null) {
1133 // Initial mount
1134
1135 // Special path for hydration
1136 // If we're currently hydrating, try to hydrate this boundary.
1137 // Hidden Activity boundaries are not emitted on the server.
1138 if (getIsHydrating()) {
1139 if (nextProps.mode === 'hidden') {
1140 // SSR doesn't render hidden Activity so it shouldn't hydrate,
1141 // even at offscreen lane. Defer to a client rendered offscreen lane.
1142 const primaryChildFragment = mountActivityChildren(
1143 workInProgress,
1144 nextProps,
1145 renderLanes,
1146 );
1147 workInProgress.lanes = laneToLanes(OffscreenLane);
1148 return bailoutOffscreenComponent(null, primaryChildFragment);
1149 } else {
1150 // We must push the suspense handler context *before* attempting to
1151 // hydrate, to avoid a mismatch in case it errors.
1152 pushDehydratedActivitySuspenseHandler(workInProgress);
1153 const dehydrated: ActivityInstance =
1154 claimNextHydratableActivityInstance(workInProgress);
1155 return mountDehydratedActivityComponent(
1156 workInProgress,
1157 dehydrated,
1158 renderLanes,
1159 );
1160 }
1161 }
1162
1163 return mountActivityChildren(workInProgress, nextProps, renderLanes);
1164 } else {
1165 // This is an update.
1166
1167 // Special path for hydration
1168 const prevState: null | ActivityState = current.memoizedState;
1169
1170 if (prevState !== null) {
1171 const dehydrated = prevState.dehydrated;
1172 return updateDehydratedActivityComponent(
1173 current,
1174 workInProgress,
1175 didSuspend,
1176 nextProps,
1177 dehydrated,
1178 prevState,

Callers 1

beginWorkFunction · 0.85

Tested by

no test coverage detected