(sourceFiber, value, expirationTime)
| 12591 | } |
| 12592 | |
| 12593 | function dispatch(sourceFiber, value, expirationTime) { |
| 12594 | !(!isWorking || isCommitting) ? invariant(false, 'dispatch: Cannot dispatch during the render phase.') : void 0; |
| 12595 | |
| 12596 | // TODO: Handle arrays |
| 12597 | |
| 12598 | var fiber = sourceFiber['return']; |
| 12599 | while (fiber !== null) { |
| 12600 | switch (fiber.tag) { |
| 12601 | case ClassComponent: |
| 12602 | var ctor = fiber.type; |
| 12603 | var instance = fiber.stateNode; |
| 12604 | if (typeof ctor.getDerivedStateFromCatch === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) { |
| 12605 | scheduleCapture(sourceFiber, fiber, value, expirationTime); |
| 12606 | return; |
| 12607 | } |
| 12608 | break; |
| 12609 | // TODO: Handle async boundaries |
| 12610 | case HostRoot: |
| 12611 | scheduleCapture(sourceFiber, fiber, value, expirationTime); |
| 12612 | return; |
| 12613 | } |
| 12614 | fiber = fiber['return']; |
| 12615 | } |
| 12616 | |
| 12617 | if (sourceFiber.tag === HostRoot) { |
| 12618 | // Error was thrown at the root. There is no parent, so the root |
| 12619 | // itself should capture it. |
| 12620 | scheduleCapture(sourceFiber, sourceFiber, value, expirationTime); |
| 12621 | } |
| 12622 | } |
| 12623 | |
| 12624 | function onCommitPhaseError(fiber, error) { |
| 12625 | return dispatch(fiber, error, Sync); |
no test coverage detected