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

Function completeWork

code/one-direction-data-flow/public/app.js:10673–10849  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

10671 }
10672
10673 function completeWork(current, workInProgress, renderExpirationTime) {
10674 var newProps = workInProgress.pendingProps;
10675 switch (workInProgress.tag) {
10676 case FunctionalComponent:
10677 return null;
10678 case ClassComponent:
10679 {
10680 // We are leaving this subtree, so pop context if any.
10681 popLegacyContextProvider(workInProgress);
10682
10683 // If this component caught an error, schedule an error log effect.
10684 var instance = workInProgress.stateNode;
10685 var updateQueue = workInProgress.updateQueue;
10686 if (updateQueue !== null && updateQueue.capturedValues !== null) {
10687 workInProgress.effectTag &= ~DidCapture;
10688 if (typeof instance.componentDidCatch === 'function') {
10689 workInProgress.effectTag |= ErrLog;
10690 } else {
10691 // Normally we clear this in the commit phase, but since we did not
10692 // schedule an effect, we need to reset it here.
10693 updateQueue.capturedValues = null;
10694 }
10695 }
10696 return null;
10697 }
10698 case HostRoot:
10699 {
10700 popHostContainer(workInProgress);
10701 popTopLevelLegacyContextObject(workInProgress);
10702 var fiberRoot = workInProgress.stateNode;
10703 if (fiberRoot.pendingContext) {
10704 fiberRoot.context = fiberRoot.pendingContext;
10705 fiberRoot.pendingContext = null;
10706 }
10707 if (current === null || current.child === null) {
10708 // If we hydrated, pop so that we can delete any remaining children
10709 // that weren't hydrated.
10710 popHydrationState(workInProgress);
10711 // This resets the hacky state to fix isMounted before committing.
10712 // TODO: Delete this when we delete isMounted and findDOMNode.
10713 workInProgress.effectTag &= ~Placement;
10714 }
10715 updateHostContainer(workInProgress);
10716
10717 var _updateQueue = workInProgress.updateQueue;
10718 if (_updateQueue !== null && _updateQueue.capturedValues !== null) {
10719 workInProgress.effectTag |= ErrLog;
10720 }
10721 return null;
10722 }
10723 case HostComponent:
10724 {
10725 popHostContext(workInProgress);
10726 var rootContainerInstance = getRootHostContainer();
10727 var type = workInProgress.type;
10728 if (current !== null && workInProgress.stateNode != null) {
10729 // If we have an alternate, that means this is an update and we need to
10730 // 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