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

Function ReactFiberUnwindWork

code/communication/public/app.js:11028–11154  ·  view source on GitHub ↗
(hostContext, legacyContext, newContext, scheduleWork, isAlreadyFailedLegacyErrorBoundary)

Source from the content-addressed store, hash-verified

11026}
11027
11028var ReactFiberUnwindWork = function (hostContext, legacyContext, newContext, scheduleWork, isAlreadyFailedLegacyErrorBoundary) {
11029 var popHostContainer = hostContext.popHostContainer,
11030 popHostContext = hostContext.popHostContext;
11031 var popLegacyContextProvider = legacyContext.popContextProvider,
11032 popTopLevelLegacyContextObject = legacyContext.popTopLevelContextObject;
11033 var popProvider = newContext.popProvider;
11034
11035
11036 function throwException(returnFiber, sourceFiber, rawValue) {
11037 // The source fiber did not complete.
11038 sourceFiber.effectTag |= Incomplete;
11039 // Its effect list is no longer valid.
11040 sourceFiber.firstEffect = sourceFiber.lastEffect = null;
11041
11042 var value = createCapturedValue(rawValue, sourceFiber);
11043
11044 var workInProgress = returnFiber;
11045 do {
11046 switch (workInProgress.tag) {
11047 case HostRoot:
11048 {
11049 // Uncaught error
11050 var errorInfo = value;
11051 ensureUpdateQueues(workInProgress);
11052 var updateQueue = workInProgress.updateQueue;
11053 updateQueue.capturedValues = [errorInfo];
11054 workInProgress.effectTag |= ShouldCapture;
11055 return;
11056 }
11057 case ClassComponent:
11058 // Capture and retry
11059 var ctor = workInProgress.type;
11060 var _instance = workInProgress.stateNode;
11061 if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromCatch === 'function' && enableGetDerivedStateFromCatch || _instance !== null && typeof _instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(_instance))) {
11062 ensureUpdateQueues(workInProgress);
11063 var _updateQueue = workInProgress.updateQueue;
11064 var capturedValues = _updateQueue.capturedValues;
11065 if (capturedValues === null) {
11066 _updateQueue.capturedValues = [value];
11067 } else {
11068 capturedValues.push(value);
11069 }
11070 workInProgress.effectTag |= ShouldCapture;
11071 return;
11072 }
11073 break;
11074 default:
11075 break;
11076 }
11077 workInProgress = workInProgress['return'];
11078 } while (workInProgress !== null);
11079 }
11080
11081 function unwindWork(workInProgress) {
11082 switch (workInProgress.tag) {
11083 case ClassComponent:
11084 {
11085 popLegacyContextProvider(workInProgress);

Callers 1

ReactFiberSchedulerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected