(sourceFiber, value, expirationTime)
| 12682 | } |
| 12683 | |
| 12684 | function dispatch(sourceFiber, value, expirationTime) { |
| 12685 | !(!isWorking || isCommitting) ? invariant(false, 'dispatch: Cannot dispatch during the render phase.') : void 0; |
| 12686 | |
| 12687 | // TODO: Handle arrays |
| 12688 | |
| 12689 | var fiber = sourceFiber['return']; |
| 12690 | while (fiber !== null) { |
| 12691 | switch (fiber.tag) { |
| 12692 | case ClassComponent: |
| 12693 | var ctor = fiber.type; |
| 12694 | var instance = fiber.stateNode; |
| 12695 | if (typeof ctor.getDerivedStateFromCatch === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) { |
| 12696 | scheduleCapture(sourceFiber, fiber, value, expirationTime); |
| 12697 | return; |
| 12698 | } |
| 12699 | break; |
| 12700 | // TODO: Handle async boundaries |
| 12701 | case HostRoot: |
| 12702 | scheduleCapture(sourceFiber, fiber, value, expirationTime); |
| 12703 | return; |
| 12704 | } |
| 12705 | fiber = fiber['return']; |
| 12706 | } |
| 12707 | |
| 12708 | if (sourceFiber.tag === HostRoot) { |
| 12709 | // Error was thrown at the root. There is no parent, so the root |
| 12710 | // itself should capture it. |
| 12711 | scheduleCapture(sourceFiber, sourceFiber, value, expirationTime); |
| 12712 | } |
| 12713 | } |
| 12714 | |
| 12715 | function onCommitPhaseError(fiber, error) { |
| 12716 | return dispatch(fiber, error, Sync); |
no test coverage detected