(sourceFiber, value, expirationTime)
| 13451 | } |
| 13452 | |
| 13453 | function dispatch(sourceFiber, value, expirationTime) { |
| 13454 | !(!isWorking || isCommitting) ? invariant(false, 'dispatch: Cannot dispatch during the render phase.') : void 0; |
| 13455 | |
| 13456 | // TODO: Handle arrays |
| 13457 | |
| 13458 | var fiber = sourceFiber['return']; |
| 13459 | while (fiber !== null) { |
| 13460 | switch (fiber.tag) { |
| 13461 | case ClassComponent: |
| 13462 | var ctor = fiber.type; |
| 13463 | var instance = fiber.stateNode; |
| 13464 | if (typeof ctor.getDerivedStateFromCatch === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) { |
| 13465 | scheduleCapture(sourceFiber, fiber, value, expirationTime); |
| 13466 | return; |
| 13467 | } |
| 13468 | break; |
| 13469 | // TODO: Handle async boundaries |
| 13470 | case HostRoot: |
| 13471 | scheduleCapture(sourceFiber, fiber, value, expirationTime); |
| 13472 | return; |
| 13473 | } |
| 13474 | fiber = fiber['return']; |
| 13475 | } |
| 13476 | |
| 13477 | if (sourceFiber.tag === HostRoot) { |
| 13478 | // Error was thrown at the root. There is no parent, so the root |
| 13479 | // itself should capture it. |
| 13480 | scheduleCapture(sourceFiber, sourceFiber, value, expirationTime); |
| 13481 | } |
| 13482 | } |
| 13483 | |
| 13484 | function onCommitPhaseError(fiber, error) { |
| 13485 | return dispatch(fiber, error, Sync); |
no test coverage detected