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

Function completeWork

code/new-context-api/public/app.js:10161–10337  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

10159 }
10160
10161 function completeWork(current, workInProgress, renderExpirationTime) {
10162 var newProps = workInProgress.pendingProps;
10163 switch (workInProgress.tag) {
10164 case FunctionalComponent:
10165 return null;
10166 case ClassComponent:
10167 {
10168 // We are leaving this subtree, so pop context if any.
10169 popLegacyContextProvider(workInProgress);
10170
10171 // If this component caught an error, schedule an error log effect.
10172 var instance = workInProgress.stateNode;
10173 var updateQueue = workInProgress.updateQueue;
10174 if (updateQueue !== null && updateQueue.capturedValues !== null) {
10175 workInProgress.effectTag &= ~DidCapture;
10176 if (typeof instance.componentDidCatch === 'function') {
10177 workInProgress.effectTag |= ErrLog;
10178 } else {
10179 // Normally we clear this in the commit phase, but since we did not
10180 // schedule an effect, we need to reset it here.
10181 updateQueue.capturedValues = null;
10182 }
10183 }
10184 return null;
10185 }
10186 case HostRoot:
10187 {
10188 popHostContainer(workInProgress);
10189 popTopLevelLegacyContextObject(workInProgress);
10190 var fiberRoot = workInProgress.stateNode;
10191 if (fiberRoot.pendingContext) {
10192 fiberRoot.context = fiberRoot.pendingContext;
10193 fiberRoot.pendingContext = null;
10194 }
10195 if (current === null || current.child === null) {
10196 // If we hydrated, pop so that we can delete any remaining children
10197 // that weren't hydrated.
10198 popHydrationState(workInProgress);
10199 // This resets the hacky state to fix isMounted before committing.
10200 // TODO: Delete this when we delete isMounted and findDOMNode.
10201 workInProgress.effectTag &= ~Placement;
10202 }
10203 updateHostContainer(workInProgress);
10204
10205 var _updateQueue = workInProgress.updateQueue;
10206 if (_updateQueue !== null && _updateQueue.capturedValues !== null) {
10207 workInProgress.effectTag |= ErrLog;
10208 }
10209 return null;
10210 }
10211 case HostComponent:
10212 {
10213 popHostContext(workInProgress);
10214 var rootContainerInstance = getRootHostContainer();
10215 var type = workInProgress.type;
10216 if (current !== null && workInProgress.stateNode != null) {
10217 // If we have an alternate, that means this is an update and we need to
10218 // schedule a side-effect to do the updates.

Callers 1

completeUnitOfWorkFunction · 0.70

Calls 15

popHostContainerFunction · 0.70
popHydrationStateFunction · 0.70
popHostContextFunction · 0.70
getRootHostContainerFunction · 0.70
getHostContextFunction · 0.70
updateHostComponentFunction · 0.70
markRefFunction · 0.70
invariantFunction · 0.70
markUpdateFunction · 0.70
appendAllChildrenFunction · 0.70
updateHostTextFunction · 0.70

Tested by

no test coverage detected