MCPcopy Index your code
hub / github.com/krasimir/react-in-patterns / updateHostRoot

Function updateHostRoot

code/redux/public/app.js:10215–10265  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

10213 }
10214
10215 function updateHostRoot(current, workInProgress, renderExpirationTime) {
10216 pushHostRootContext(workInProgress);
10217 var updateQueue = workInProgress.updateQueue;
10218 if (updateQueue !== null) {
10219 var prevState = workInProgress.memoizedState;
10220 var state = processUpdateQueue(current, workInProgress, updateQueue, null, null, renderExpirationTime);
10221 memoizeState(workInProgress, state);
10222 updateQueue = workInProgress.updateQueue;
10223
10224 var element = void 0;
10225 if (updateQueue !== null && updateQueue.capturedValues !== null) {
10226 // There's an uncaught error. Unmount the whole root.
10227 element = null;
10228 } else if (prevState === state) {
10229 // If the state is the same as before, that's a bailout because we had
10230 // no work that expires at this time.
10231 resetHydrationState();
10232 return bailoutOnAlreadyFinishedWork(current, workInProgress);
10233 } else {
10234 element = state.element;
10235 }
10236 var root = workInProgress.stateNode;
10237 if ((current === null || current.child === null) && root.hydrate && enterHydrationState(workInProgress)) {
10238 // If we don't have any current children this might be the first pass.
10239 // We always try to hydrate. If this isn't a hydration pass there won't
10240 // be any children to hydrate which is effectively the same thing as
10241 // not hydrating.
10242
10243 // This is a bit of a hack. We track the host root as a placement to
10244 // know that we're currently in a mounting state. That way isMounted
10245 // works as expected. We must reset this before committing.
10246 // TODO: Delete this when we delete isMounted and findDOMNode.
10247 workInProgress.effectTag |= Placement;
10248
10249 // Ensure that children mount into this root without tracking
10250 // side-effects. This ensures that we don't store Placement effects on
10251 // nodes that will be hydrated.
10252 workInProgress.child = mountChildFibers(workInProgress, null, element, renderExpirationTime);
10253 } else {
10254 // Otherwise reset hydration state in case we aborted and resumed another
10255 // root.
10256 resetHydrationState();
10257 reconcileChildren(current, workInProgress, element);
10258 }
10259 memoizeState(workInProgress, state);
10260 return workInProgress.child;
10261 }
10262 resetHydrationState();
10263 // If there is no update queue, that's a bailout because the root has no props.
10264 return bailoutOnAlreadyFinishedWork(current, workInProgress);
10265 }
10266
10267 function updateHostComponent(current, workInProgress, renderExpirationTime) {
10268 pushHostContext(workInProgress);

Callers 1

beginWorkFunction · 0.70

Calls 7

pushHostRootContextFunction · 0.70
processUpdateQueueFunction · 0.70
memoizeStateFunction · 0.70
resetHydrationStateFunction · 0.70
enterHydrationStateFunction · 0.70
reconcileChildrenFunction · 0.70

Tested by

no test coverage detected