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

Function ReactFiberUnwindWork

code/third-party/public/app.js:10226–10352  ·  view source on GitHub ↗
(hostContext, legacyContext, newContext, scheduleWork, isAlreadyFailedLegacyErrorBoundary)

Source from the content-addressed store, hash-verified

10224}
10225
10226var ReactFiberUnwindWork = function (hostContext, legacyContext, newContext, scheduleWork, isAlreadyFailedLegacyErrorBoundary) {
10227 var popHostContainer = hostContext.popHostContainer,
10228 popHostContext = hostContext.popHostContext;
10229 var popLegacyContextProvider = legacyContext.popContextProvider,
10230 popTopLevelLegacyContextObject = legacyContext.popTopLevelContextObject;
10231 var popProvider = newContext.popProvider;
10232
10233
10234 function throwException(returnFiber, sourceFiber, rawValue) {
10235 // The source fiber did not complete.
10236 sourceFiber.effectTag |= Incomplete;
10237 // Its effect list is no longer valid.
10238 sourceFiber.firstEffect = sourceFiber.lastEffect = null;
10239
10240 var value = createCapturedValue(rawValue, sourceFiber);
10241
10242 var workInProgress = returnFiber;
10243 do {
10244 switch (workInProgress.tag) {
10245 case HostRoot:
10246 {
10247 // Uncaught error
10248 var errorInfo = value;
10249 ensureUpdateQueues(workInProgress);
10250 var updateQueue = workInProgress.updateQueue;
10251 updateQueue.capturedValues = [errorInfo];
10252 workInProgress.effectTag |= ShouldCapture;
10253 return;
10254 }
10255 case ClassComponent:
10256 // Capture and retry
10257 var ctor = workInProgress.type;
10258 var _instance = workInProgress.stateNode;
10259 if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromCatch === 'function' && enableGetDerivedStateFromCatch || _instance !== null && typeof _instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(_instance))) {
10260 ensureUpdateQueues(workInProgress);
10261 var _updateQueue = workInProgress.updateQueue;
10262 var capturedValues = _updateQueue.capturedValues;
10263 if (capturedValues === null) {
10264 _updateQueue.capturedValues = [value];
10265 } else {
10266 capturedValues.push(value);
10267 }
10268 workInProgress.effectTag |= ShouldCapture;
10269 return;
10270 }
10271 break;
10272 default:
10273 break;
10274 }
10275 workInProgress = workInProgress['return'];
10276 } while (workInProgress !== null);
10277 }
10278
10279 function unwindWork(workInProgress) {
10280 switch (workInProgress.tag) {
10281 case ClassComponent:
10282 {
10283 popLegacyContextProvider(workInProgress);

Callers 1

ReactFiberSchedulerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected