MCPcopy Index your code
hub / github.com/krasimir/react-in-patterns / dispatch

Function dispatch

code/composition/public/app.js:13498–13527  ·  view source on GitHub ↗
(sourceFiber, value, expirationTime)

Source from the content-addressed store, hash-verified

13496 }
13497
13498 function dispatch(sourceFiber, value, expirationTime) {
13499 !(!isWorking || isCommitting) ? invariant(false, 'dispatch: Cannot dispatch during the render phase.') : void 0;
13500
13501 // TODO: Handle arrays
13502
13503 var fiber = sourceFiber['return'];
13504 while (fiber !== null) {
13505 switch (fiber.tag) {
13506 case ClassComponent:
13507 var ctor = fiber.type;
13508 var instance = fiber.stateNode;
13509 if (typeof ctor.getDerivedStateFromCatch === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) {
13510 scheduleCapture(sourceFiber, fiber, value, expirationTime);
13511 return;
13512 }
13513 break;
13514 // TODO: Handle async boundaries
13515 case HostRoot:
13516 scheduleCapture(sourceFiber, fiber, value, expirationTime);
13517 return;
13518 }
13519 fiber = fiber['return'];
13520 }
13521
13522 if (sourceFiber.tag === HostRoot) {
13523 // Error was thrown at the root. There is no parent, so the root
13524 // itself should capture it.
13525 scheduleCapture(sourceFiber, sourceFiber, value, expirationTime);
13526 }
13527 }
13528
13529 function onCommitPhaseError(fiber, error) {
13530 return dispatch(fiber, error, Sync);

Callers 1

onCommitPhaseErrorFunction · 0.70

Calls 3

invariantFunction · 0.70
scheduleCaptureFunction · 0.70

Tested by

no test coverage detected