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

Function completeWork

code/styling/public/app.js:10800–10976  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

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