(sourceFiber, value, expirationTime)
| 13231 | } |
| 13232 | |
| 13233 | function dispatch(sourceFiber, value, expirationTime) { |
| 13234 | !(!isWorking || isCommitting) ? invariant(false, 'dispatch: Cannot dispatch during the render phase.') : void 0; |
| 13235 | |
| 13236 | // TODO: Handle arrays |
| 13237 | |
| 13238 | var fiber = sourceFiber['return']; |
| 13239 | while (fiber !== null) { |
| 13240 | switch (fiber.tag) { |
| 13241 | case ClassComponent: |
| 13242 | var ctor = fiber.type; |
| 13243 | var instance = fiber.stateNode; |
| 13244 | if (typeof ctor.getDerivedStateFromCatch === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) { |
| 13245 | scheduleCapture(sourceFiber, fiber, value, expirationTime); |
| 13246 | return; |
| 13247 | } |
| 13248 | break; |
| 13249 | // TODO: Handle async boundaries |
| 13250 | case HostRoot: |
| 13251 | scheduleCapture(sourceFiber, fiber, value, expirationTime); |
| 13252 | return; |
| 13253 | } |
| 13254 | fiber = fiber['return']; |
| 13255 | } |
| 13256 | |
| 13257 | if (sourceFiber.tag === HostRoot) { |
| 13258 | // Error was thrown at the root. There is no parent, so the root |
| 13259 | // itself should capture it. |
| 13260 | scheduleCapture(sourceFiber, sourceFiber, value, expirationTime); |
| 13261 | } |
| 13262 | } |
| 13263 | |
| 13264 | function onCommitPhaseError(fiber, error) { |
| 13265 | return dispatch(fiber, error, Sync); |
no test coverage detected