MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / completeWork

Function completeWork

code/event-handlers/public/app.js:10130–10306  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

10128 }
10129
10130 function completeWork(current, workInProgress, renderExpirationTime) {
10131 var newProps = workInProgress.pendingProps;
10132 switch (workInProgress.tag) {
10133 case FunctionalComponent:
10134 return null;
10135 case ClassComponent:
10136 {
10137 // We are leaving this subtree, so pop context if any.
10138 popLegacyContextProvider(workInProgress);
10139
10140 // If this component caught an error, schedule an error log effect.
10141 var instance = workInProgress.stateNode;
10142 var updateQueue = workInProgress.updateQueue;
10143 if (updateQueue !== null && updateQueue.capturedValues !== null) {
10144 workInProgress.effectTag &= ~DidCapture;
10145 if (typeof instance.componentDidCatch === 'function') {
10146 workInProgress.effectTag |= ErrLog;
10147 } else {
10148 // Normally we clear this in the commit phase, but since we did not
10149 // schedule an effect, we need to reset it here.
10150 updateQueue.capturedValues = null;
10151 }
10152 }
10153 return null;
10154 }
10155 case HostRoot:
10156 {
10157 popHostContainer(workInProgress);
10158 popTopLevelLegacyContextObject(workInProgress);
10159 var fiberRoot = workInProgress.stateNode;
10160 if (fiberRoot.pendingContext) {
10161 fiberRoot.context = fiberRoot.pendingContext;
10162 fiberRoot.pendingContext = null;
10163 }
10164 if (current === null || current.child === null) {
10165 // If we hydrated, pop so that we can delete any remaining children
10166 // that weren't hydrated.
10167 popHydrationState(workInProgress);
10168 // This resets the hacky state to fix isMounted before committing.
10169 // TODO: Delete this when we delete isMounted and findDOMNode.
10170 workInProgress.effectTag &= ~Placement;
10171 }
10172 updateHostContainer(workInProgress);
10173
10174 var _updateQueue = workInProgress.updateQueue;
10175 if (_updateQueue !== null && _updateQueue.capturedValues !== null) {
10176 workInProgress.effectTag |= ErrLog;
10177 }
10178 return null;
10179 }
10180 case HostComponent:
10181 {
10182 popHostContext(workInProgress);
10183 var rootContainerInstance = getRootHostContainer();
10184 var type = workInProgress.type;
10185 if (current !== null && workInProgress.stateNode != null) {
10186 // If we have an alternate, that means this is an update and we need to
10187 // 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