(sourceFiber, value, expirationTime)
| 12719 | } |
| 12720 | |
| 12721 | function dispatch(sourceFiber, value, expirationTime) { |
| 12722 | !(!isWorking || isCommitting) ? invariant(false, 'dispatch: Cannot dispatch during the render phase.') : void 0; |
| 12723 | |
| 12724 | // TODO: Handle arrays |
| 12725 | |
| 12726 | var fiber = sourceFiber['return']; |
| 12727 | while (fiber !== null) { |
| 12728 | switch (fiber.tag) { |
| 12729 | case ClassComponent: |
| 12730 | var ctor = fiber.type; |
| 12731 | var instance = fiber.stateNode; |
| 12732 | if (typeof ctor.getDerivedStateFromCatch === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) { |
| 12733 | scheduleCapture(sourceFiber, fiber, value, expirationTime); |
| 12734 | return; |
| 12735 | } |
| 12736 | break; |
| 12737 | // TODO: Handle async boundaries |
| 12738 | case HostRoot: |
| 12739 | scheduleCapture(sourceFiber, fiber, value, expirationTime); |
| 12740 | return; |
| 12741 | } |
| 12742 | fiber = fiber['return']; |
| 12743 | } |
| 12744 | |
| 12745 | if (sourceFiber.tag === HostRoot) { |
| 12746 | // Error was thrown at the root. There is no parent, so the root |
| 12747 | // itself should capture it. |
| 12748 | scheduleCapture(sourceFiber, sourceFiber, value, expirationTime); |
| 12749 | } |
| 12750 | } |
| 12751 | |
| 12752 | function onCommitPhaseError(fiber, error) { |
| 12753 | return dispatch(fiber, error, Sync); |
no test coverage detected