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

Function completeWork

code/dependency-injection/public/app.js:10893–11069  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

10891 }
10892
10893 function completeWork(current, workInProgress, renderExpirationTime) {
10894 var newProps = workInProgress.pendingProps;
10895 switch (workInProgress.tag) {
10896 case FunctionalComponent:
10897 return null;
10898 case ClassComponent:
10899 {
10900 // We are leaving this subtree, so pop context if any.
10901 popLegacyContextProvider(workInProgress);
10902
10903 // If this component caught an error, schedule an error log effect.
10904 var instance = workInProgress.stateNode;
10905 var updateQueue = workInProgress.updateQueue;
10906 if (updateQueue !== null && updateQueue.capturedValues !== null) {
10907 workInProgress.effectTag &= ~DidCapture;
10908 if (typeof instance.componentDidCatch === 'function') {
10909 workInProgress.effectTag |= ErrLog;
10910 } else {
10911 // Normally we clear this in the commit phase, but since we did not
10912 // schedule an effect, we need to reset it here.
10913 updateQueue.capturedValues = null;
10914 }
10915 }
10916 return null;
10917 }
10918 case HostRoot:
10919 {
10920 popHostContainer(workInProgress);
10921 popTopLevelLegacyContextObject(workInProgress);
10922 var fiberRoot = workInProgress.stateNode;
10923 if (fiberRoot.pendingContext) {
10924 fiberRoot.context = fiberRoot.pendingContext;
10925 fiberRoot.pendingContext = null;
10926 }
10927 if (current === null || current.child === null) {
10928 // If we hydrated, pop so that we can delete any remaining children
10929 // that weren't hydrated.
10930 popHydrationState(workInProgress);
10931 // This resets the hacky state to fix isMounted before committing.
10932 // TODO: Delete this when we delete isMounted and findDOMNode.
10933 workInProgress.effectTag &= ~Placement;
10934 }
10935 updateHostContainer(workInProgress);
10936
10937 var _updateQueue = workInProgress.updateQueue;
10938 if (_updateQueue !== null && _updateQueue.capturedValues !== null) {
10939 workInProgress.effectTag |= ErrLog;
10940 }
10941 return null;
10942 }
10943 case HostComponent:
10944 {
10945 popHostContext(workInProgress);
10946 var rootContainerInstance = getRootHostContainer();
10947 var type = workInProgress.type;
10948 if (current !== null && workInProgress.stateNode != null) {
10949 // If we have an alternate, that means this is an update and we need to
10950 // 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