MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / dispatch

Function dispatch

code/event-handlers/public/app.js:12690–12719  ·  view source on GitHub ↗
(sourceFiber, value, expirationTime)

Source from the content-addressed store, hash-verified

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

Callers 1

onCommitPhaseErrorFunction · 0.70

Calls 3

invariantFunction · 0.70
scheduleCaptureFunction · 0.70

Tested by

no test coverage detected