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

Function ReactFiberUnwindWork

code/new-context-api/public/app.js:10354–10480  ·  view source on GitHub ↗
(hostContext, legacyContext, newContext, scheduleWork, isAlreadyFailedLegacyErrorBoundary)

Source from the content-addressed store, hash-verified

10352}
10353
10354var ReactFiberUnwindWork = function (hostContext, legacyContext, newContext, scheduleWork, isAlreadyFailedLegacyErrorBoundary) {
10355 var popHostContainer = hostContext.popHostContainer,
10356 popHostContext = hostContext.popHostContext;
10357 var popLegacyContextProvider = legacyContext.popContextProvider,
10358 popTopLevelLegacyContextObject = legacyContext.popTopLevelContextObject;
10359 var popProvider = newContext.popProvider;
10360
10361
10362 function throwException(returnFiber, sourceFiber, rawValue) {
10363 // The source fiber did not complete.
10364 sourceFiber.effectTag |= Incomplete;
10365 // Its effect list is no longer valid.
10366 sourceFiber.firstEffect = sourceFiber.lastEffect = null;
10367
10368 var value = createCapturedValue(rawValue, sourceFiber);
10369
10370 var workInProgress = returnFiber;
10371 do {
10372 switch (workInProgress.tag) {
10373 case HostRoot:
10374 {
10375 // Uncaught error
10376 var errorInfo = value;
10377 ensureUpdateQueues(workInProgress);
10378 var updateQueue = workInProgress.updateQueue;
10379 updateQueue.capturedValues = [errorInfo];
10380 workInProgress.effectTag |= ShouldCapture;
10381 return;
10382 }
10383 case ClassComponent:
10384 // Capture and retry
10385 var ctor = workInProgress.type;
10386 var _instance = workInProgress.stateNode;
10387 if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromCatch === 'function' && enableGetDerivedStateFromCatch || _instance !== null && typeof _instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(_instance))) {
10388 ensureUpdateQueues(workInProgress);
10389 var _updateQueue = workInProgress.updateQueue;
10390 var capturedValues = _updateQueue.capturedValues;
10391 if (capturedValues === null) {
10392 _updateQueue.capturedValues = [value];
10393 } else {
10394 capturedValues.push(value);
10395 }
10396 workInProgress.effectTag |= ShouldCapture;
10397 return;
10398 }
10399 break;
10400 default:
10401 break;
10402 }
10403 workInProgress = workInProgress['return'];
10404 } while (workInProgress !== null);
10405 }
10406
10407 function unwindWork(workInProgress) {
10408 switch (workInProgress.tag) {
10409 case ClassComponent:
10410 {
10411 popLegacyContextProvider(workInProgress);

Callers 1

ReactFiberSchedulerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected