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

Function ReactFiberUnwindWork

code/styling/public/app.js:10993–11119  ·  view source on GitHub ↗
(hostContext, legacyContext, newContext, scheduleWork, isAlreadyFailedLegacyErrorBoundary)

Source from the content-addressed store, hash-verified

10991}
10992
10993var ReactFiberUnwindWork = function (hostContext, legacyContext, newContext, scheduleWork, isAlreadyFailedLegacyErrorBoundary) {
10994 var popHostContainer = hostContext.popHostContainer,
10995 popHostContext = hostContext.popHostContext;
10996 var popLegacyContextProvider = legacyContext.popContextProvider,
10997 popTopLevelLegacyContextObject = legacyContext.popTopLevelContextObject;
10998 var popProvider = newContext.popProvider;
10999
11000
11001 function throwException(returnFiber, sourceFiber, rawValue) {
11002 // The source fiber did not complete.
11003 sourceFiber.effectTag |= Incomplete;
11004 // Its effect list is no longer valid.
11005 sourceFiber.firstEffect = sourceFiber.lastEffect = null;
11006
11007 var value = createCapturedValue(rawValue, sourceFiber);
11008
11009 var workInProgress = returnFiber;
11010 do {
11011 switch (workInProgress.tag) {
11012 case HostRoot:
11013 {
11014 // Uncaught error
11015 var errorInfo = value;
11016 ensureUpdateQueues(workInProgress);
11017 var updateQueue = workInProgress.updateQueue;
11018 updateQueue.capturedValues = [errorInfo];
11019 workInProgress.effectTag |= ShouldCapture;
11020 return;
11021 }
11022 case ClassComponent:
11023 // Capture and retry
11024 var ctor = workInProgress.type;
11025 var _instance = workInProgress.stateNode;
11026 if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromCatch === 'function' && enableGetDerivedStateFromCatch || _instance !== null && typeof _instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(_instance))) {
11027 ensureUpdateQueues(workInProgress);
11028 var _updateQueue = workInProgress.updateQueue;
11029 var capturedValues = _updateQueue.capturedValues;
11030 if (capturedValues === null) {
11031 _updateQueue.capturedValues = [value];
11032 } else {
11033 capturedValues.push(value);
11034 }
11035 workInProgress.effectTag |= ShouldCapture;
11036 return;
11037 }
11038 break;
11039 default:
11040 break;
11041 }
11042 workInProgress = workInProgress['return'];
11043 } while (workInProgress !== null);
11044 }
11045
11046 function unwindWork(workInProgress) {
11047 switch (workInProgress.tag) {
11048 case ClassComponent:
11049 {
11050 popLegacyContextProvider(workInProgress);

Callers 1

ReactFiberSchedulerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected