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

Function completeWork

code/third-party/public/app.js:10033–10209  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

10031 }
10032
10033 function completeWork(current, workInProgress, renderExpirationTime) {
10034 var newProps = workInProgress.pendingProps;
10035 switch (workInProgress.tag) {
10036 case FunctionalComponent:
10037 return null;
10038 case ClassComponent:
10039 {
10040 // We are leaving this subtree, so pop context if any.
10041 popLegacyContextProvider(workInProgress);
10042
10043 // If this component caught an error, schedule an error log effect.
10044 var instance = workInProgress.stateNode;
10045 var updateQueue = workInProgress.updateQueue;
10046 if (updateQueue !== null && updateQueue.capturedValues !== null) {
10047 workInProgress.effectTag &= ~DidCapture;
10048 if (typeof instance.componentDidCatch === 'function') {
10049 workInProgress.effectTag |= ErrLog;
10050 } else {
10051 // Normally we clear this in the commit phase, but since we did not
10052 // schedule an effect, we need to reset it here.
10053 updateQueue.capturedValues = null;
10054 }
10055 }
10056 return null;
10057 }
10058 case HostRoot:
10059 {
10060 popHostContainer(workInProgress);
10061 popTopLevelLegacyContextObject(workInProgress);
10062 var fiberRoot = workInProgress.stateNode;
10063 if (fiberRoot.pendingContext) {
10064 fiberRoot.context = fiberRoot.pendingContext;
10065 fiberRoot.pendingContext = null;
10066 }
10067 if (current === null || current.child === null) {
10068 // If we hydrated, pop so that we can delete any remaining children
10069 // that weren't hydrated.
10070 popHydrationState(workInProgress);
10071 // This resets the hacky state to fix isMounted before committing.
10072 // TODO: Delete this when we delete isMounted and findDOMNode.
10073 workInProgress.effectTag &= ~Placement;
10074 }
10075 updateHostContainer(workInProgress);
10076
10077 var _updateQueue = workInProgress.updateQueue;
10078 if (_updateQueue !== null && _updateQueue.capturedValues !== null) {
10079 workInProgress.effectTag |= ErrLog;
10080 }
10081 return null;
10082 }
10083 case HostComponent:
10084 {
10085 popHostContext(workInProgress);
10086 var rootContainerInstance = getRootHostContainer();
10087 var type = workInProgress.type;
10088 if (current !== null && workInProgress.stateNode != null) {
10089 // If we have an alternate, that means this is an update and we need to
10090 // 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