(sourceFiber, value, expirationTime)
| 13609 | } |
| 13610 | |
| 13611 | function dispatch(sourceFiber, value, expirationTime) { |
| 13612 | !(!isWorking || isCommitting) ? invariant(false, 'dispatch: Cannot dispatch during the render phase.') : void 0; |
| 13613 | |
| 13614 | // TODO: Handle arrays |
| 13615 | |
| 13616 | var fiber = sourceFiber['return']; |
| 13617 | while (fiber !== null) { |
| 13618 | switch (fiber.tag) { |
| 13619 | case ClassComponent: |
| 13620 | var ctor = fiber.type; |
| 13621 | var instance = fiber.stateNode; |
| 13622 | if (typeof ctor.getDerivedStateFromCatch === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) { |
| 13623 | scheduleCapture(sourceFiber, fiber, value, expirationTime); |
| 13624 | return; |
| 13625 | } |
| 13626 | break; |
| 13627 | // TODO: Handle async boundaries |
| 13628 | case HostRoot: |
| 13629 | scheduleCapture(sourceFiber, fiber, value, expirationTime); |
| 13630 | return; |
| 13631 | } |
| 13632 | fiber = fiber['return']; |
| 13633 | } |
| 13634 | |
| 13635 | if (sourceFiber.tag === HostRoot) { |
| 13636 | // Error was thrown at the root. There is no parent, so the root |
| 13637 | // itself should capture it. |
| 13638 | scheduleCapture(sourceFiber, sourceFiber, value, expirationTime); |
| 13639 | } |
| 13640 | } |
| 13641 | |
| 13642 | function onCommitPhaseError(fiber, error) { |
| 13643 | return dispatch(fiber, error, Sync); |
no test coverage detected