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

Function updateHostRoot

code/composition/public/app.js:10102–10152  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

10100 }
10101
10102 function updateHostRoot(current, workInProgress, renderExpirationTime) {
10103 pushHostRootContext(workInProgress);
10104 var updateQueue = workInProgress.updateQueue;
10105 if (updateQueue !== null) {
10106 var prevState = workInProgress.memoizedState;
10107 var state = processUpdateQueue(current, workInProgress, updateQueue, null, null, renderExpirationTime);
10108 memoizeState(workInProgress, state);
10109 updateQueue = workInProgress.updateQueue;
10110
10111 var element = void 0;
10112 if (updateQueue !== null && updateQueue.capturedValues !== null) {
10113 // There's an uncaught error. Unmount the whole root.
10114 element = null;
10115 } else if (prevState === state) {
10116 // If the state is the same as before, that's a bailout because we had
10117 // no work that expires at this time.
10118 resetHydrationState();
10119 return bailoutOnAlreadyFinishedWork(current, workInProgress);
10120 } else {
10121 element = state.element;
10122 }
10123 var root = workInProgress.stateNode;
10124 if ((current === null || current.child === null) && root.hydrate && enterHydrationState(workInProgress)) {
10125 // If we don't have any current children this might be the first pass.
10126 // We always try to hydrate. If this isn't a hydration pass there won't
10127 // be any children to hydrate which is effectively the same thing as
10128 // not hydrating.
10129
10130 // This is a bit of a hack. We track the host root as a placement to
10131 // know that we're currently in a mounting state. That way isMounted
10132 // works as expected. We must reset this before committing.
10133 // TODO: Delete this when we delete isMounted and findDOMNode.
10134 workInProgress.effectTag |= Placement;
10135
10136 // Ensure that children mount into this root without tracking
10137 // side-effects. This ensures that we don't store Placement effects on
10138 // nodes that will be hydrated.
10139 workInProgress.child = mountChildFibers(workInProgress, null, element, renderExpirationTime);
10140 } else {
10141 // Otherwise reset hydration state in case we aborted and resumed another
10142 // root.
10143 resetHydrationState();
10144 reconcileChildren(current, workInProgress, element);
10145 }
10146 memoizeState(workInProgress, state);
10147 return workInProgress.child;
10148 }
10149 resetHydrationState();
10150 // If there is no update queue, that's a bailout because the root has no props.
10151 return bailoutOnAlreadyFinishedWork(current, workInProgress);
10152 }
10153
10154 function updateHostComponent(current, workInProgress, renderExpirationTime) {
10155 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