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

Function ReactFiberUnwindWork

code/dependency-injection/public/app.js:11086–11212  ·  view source on GitHub ↗
(hostContext, legacyContext, newContext, scheduleWork, isAlreadyFailedLegacyErrorBoundary)

Source from the content-addressed store, hash-verified

11084}
11085
11086var ReactFiberUnwindWork = function (hostContext, legacyContext, newContext, scheduleWork, isAlreadyFailedLegacyErrorBoundary) {
11087 var popHostContainer = hostContext.popHostContainer,
11088 popHostContext = hostContext.popHostContext;
11089 var popLegacyContextProvider = legacyContext.popContextProvider,
11090 popTopLevelLegacyContextObject = legacyContext.popTopLevelContextObject;
11091 var popProvider = newContext.popProvider;
11092
11093
11094 function throwException(returnFiber, sourceFiber, rawValue) {
11095 // The source fiber did not complete.
11096 sourceFiber.effectTag |= Incomplete;
11097 // Its effect list is no longer valid.
11098 sourceFiber.firstEffect = sourceFiber.lastEffect = null;
11099
11100 var value = createCapturedValue(rawValue, sourceFiber);
11101
11102 var workInProgress = returnFiber;
11103 do {
11104 switch (workInProgress.tag) {
11105 case HostRoot:
11106 {
11107 // Uncaught error
11108 var errorInfo = value;
11109 ensureUpdateQueues(workInProgress);
11110 var updateQueue = workInProgress.updateQueue;
11111 updateQueue.capturedValues = [errorInfo];
11112 workInProgress.effectTag |= ShouldCapture;
11113 return;
11114 }
11115 case ClassComponent:
11116 // Capture and retry
11117 var ctor = workInProgress.type;
11118 var _instance = workInProgress.stateNode;
11119 if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromCatch === 'function' && enableGetDerivedStateFromCatch || _instance !== null && typeof _instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(_instance))) {
11120 ensureUpdateQueues(workInProgress);
11121 var _updateQueue = workInProgress.updateQueue;
11122 var capturedValues = _updateQueue.capturedValues;
11123 if (capturedValues === null) {
11124 _updateQueue.capturedValues = [value];
11125 } else {
11126 capturedValues.push(value);
11127 }
11128 workInProgress.effectTag |= ShouldCapture;
11129 return;
11130 }
11131 break;
11132 default:
11133 break;
11134 }
11135 workInProgress = workInProgress['return'];
11136 } while (workInProgress !== null);
11137 }
11138
11139 function unwindWork(workInProgress) {
11140 switch (workInProgress.tag) {
11141 case ClassComponent:
11142 {
11143 popLegacyContextProvider(workInProgress);

Callers 1

ReactFiberSchedulerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected