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

Function ReactFiberUnwindWork

code/composition/public/app.js:11131–11257  ·  view source on GitHub ↗
(hostContext, legacyContext, newContext, scheduleWork, isAlreadyFailedLegacyErrorBoundary)

Source from the content-addressed store, hash-verified

11129}
11130
11131var ReactFiberUnwindWork = function (hostContext, legacyContext, newContext, scheduleWork, isAlreadyFailedLegacyErrorBoundary) {
11132 var popHostContainer = hostContext.popHostContainer,
11133 popHostContext = hostContext.popHostContext;
11134 var popLegacyContextProvider = legacyContext.popContextProvider,
11135 popTopLevelLegacyContextObject = legacyContext.popTopLevelContextObject;
11136 var popProvider = newContext.popProvider;
11137
11138
11139 function throwException(returnFiber, sourceFiber, rawValue) {
11140 // The source fiber did not complete.
11141 sourceFiber.effectTag |= Incomplete;
11142 // Its effect list is no longer valid.
11143 sourceFiber.firstEffect = sourceFiber.lastEffect = null;
11144
11145 var value = createCapturedValue(rawValue, sourceFiber);
11146
11147 var workInProgress = returnFiber;
11148 do {
11149 switch (workInProgress.tag) {
11150 case HostRoot:
11151 {
11152 // Uncaught error
11153 var errorInfo = value;
11154 ensureUpdateQueues(workInProgress);
11155 var updateQueue = workInProgress.updateQueue;
11156 updateQueue.capturedValues = [errorInfo];
11157 workInProgress.effectTag |= ShouldCapture;
11158 return;
11159 }
11160 case ClassComponent:
11161 // Capture and retry
11162 var ctor = workInProgress.type;
11163 var _instance = workInProgress.stateNode;
11164 if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromCatch === 'function' && enableGetDerivedStateFromCatch || _instance !== null && typeof _instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(_instance))) {
11165 ensureUpdateQueues(workInProgress);
11166 var _updateQueue = workInProgress.updateQueue;
11167 var capturedValues = _updateQueue.capturedValues;
11168 if (capturedValues === null) {
11169 _updateQueue.capturedValues = [value];
11170 } else {
11171 capturedValues.push(value);
11172 }
11173 workInProgress.effectTag |= ShouldCapture;
11174 return;
11175 }
11176 break;
11177 default:
11178 break;
11179 }
11180 workInProgress = workInProgress['return'];
11181 } while (workInProgress !== null);
11182 }
11183
11184 function unwindWork(workInProgress) {
11185 switch (workInProgress.tag) {
11186 case ClassComponent:
11187 {
11188 popLegacyContextProvider(workInProgress);

Callers 1

ReactFiberSchedulerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected