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

Function completeWork

code/communication/public/app.js:10835–11011  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

10833 }
10834
10835 function completeWork(current, workInProgress, renderExpirationTime) {
10836 var newProps = workInProgress.pendingProps;
10837 switch (workInProgress.tag) {
10838 case FunctionalComponent:
10839 return null;
10840 case ClassComponent:
10841 {
10842 // We are leaving this subtree, so pop context if any.
10843 popLegacyContextProvider(workInProgress);
10844
10845 // If this component caught an error, schedule an error log effect.
10846 var instance = workInProgress.stateNode;
10847 var updateQueue = workInProgress.updateQueue;
10848 if (updateQueue !== null && updateQueue.capturedValues !== null) {
10849 workInProgress.effectTag &= ~DidCapture;
10850 if (typeof instance.componentDidCatch === 'function') {
10851 workInProgress.effectTag |= ErrLog;
10852 } else {
10853 // Normally we clear this in the commit phase, but since we did not
10854 // schedule an effect, we need to reset it here.
10855 updateQueue.capturedValues = null;
10856 }
10857 }
10858 return null;
10859 }
10860 case HostRoot:
10861 {
10862 popHostContainer(workInProgress);
10863 popTopLevelLegacyContextObject(workInProgress);
10864 var fiberRoot = workInProgress.stateNode;
10865 if (fiberRoot.pendingContext) {
10866 fiberRoot.context = fiberRoot.pendingContext;
10867 fiberRoot.pendingContext = null;
10868 }
10869 if (current === null || current.child === null) {
10870 // If we hydrated, pop so that we can delete any remaining children
10871 // that weren't hydrated.
10872 popHydrationState(workInProgress);
10873 // This resets the hacky state to fix isMounted before committing.
10874 // TODO: Delete this when we delete isMounted and findDOMNode.
10875 workInProgress.effectTag &= ~Placement;
10876 }
10877 updateHostContainer(workInProgress);
10878
10879 var _updateQueue = workInProgress.updateQueue;
10880 if (_updateQueue !== null && _updateQueue.capturedValues !== null) {
10881 workInProgress.effectTag |= ErrLog;
10882 }
10883 return null;
10884 }
10885 case HostComponent:
10886 {
10887 popHostContext(workInProgress);
10888 var rootContainerInstance = getRootHostContainer();
10889 var type = workInProgress.type;
10890 if (current !== null && workInProgress.stateNode != null) {
10891 // If we have an alternate, that means this is an update and we need to
10892 // 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