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

Function completeWork

code/higher-order-components/public/app.js:10794–10970  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

10792 }
10793
10794 function completeWork(current, workInProgress, renderExpirationTime) {
10795 var newProps = workInProgress.pendingProps;
10796 switch (workInProgress.tag) {
10797 case FunctionalComponent:
10798 return null;
10799 case ClassComponent:
10800 {
10801 // We are leaving this subtree, so pop context if any.
10802 popLegacyContextProvider(workInProgress);
10803
10804 // If this component caught an error, schedule an error log effect.
10805 var instance = workInProgress.stateNode;
10806 var updateQueue = workInProgress.updateQueue;
10807 if (updateQueue !== null && updateQueue.capturedValues !== null) {
10808 workInProgress.effectTag &= ~DidCapture;
10809 if (typeof instance.componentDidCatch === 'function') {
10810 workInProgress.effectTag |= ErrLog;
10811 } else {
10812 // Normally we clear this in the commit phase, but since we did not
10813 // schedule an effect, we need to reset it here.
10814 updateQueue.capturedValues = null;
10815 }
10816 }
10817 return null;
10818 }
10819 case HostRoot:
10820 {
10821 popHostContainer(workInProgress);
10822 popTopLevelLegacyContextObject(workInProgress);
10823 var fiberRoot = workInProgress.stateNode;
10824 if (fiberRoot.pendingContext) {
10825 fiberRoot.context = fiberRoot.pendingContext;
10826 fiberRoot.pendingContext = null;
10827 }
10828 if (current === null || current.child === null) {
10829 // If we hydrated, pop so that we can delete any remaining children
10830 // that weren't hydrated.
10831 popHydrationState(workInProgress);
10832 // This resets the hacky state to fix isMounted before committing.
10833 // TODO: Delete this when we delete isMounted and findDOMNode.
10834 workInProgress.effectTag &= ~Placement;
10835 }
10836 updateHostContainer(workInProgress);
10837
10838 var _updateQueue = workInProgress.updateQueue;
10839 if (_updateQueue !== null && _updateQueue.capturedValues !== null) {
10840 workInProgress.effectTag |= ErrLog;
10841 }
10842 return null;
10843 }
10844 case HostComponent:
10845 {
10846 popHostContext(workInProgress);
10847 var rootContainerInstance = getRootHostContainer();
10848 var type = workInProgress.type;
10849 if (current !== null && workInProgress.stateNode != null) {
10850 // If we have an alternate, that means this is an update and we need to
10851 // 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