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

Function dispatch

code/redux/public/app.js:13611–13640  ·  view source on GitHub ↗
(sourceFiber, value, expirationTime)

Source from the content-addressed store, hash-verified

13609 }
13610
13611 function dispatch(sourceFiber, value, expirationTime) {
13612 !(!isWorking || isCommitting) ? invariant(false, 'dispatch: Cannot dispatch during the render phase.') : void 0;
13613
13614 // TODO: Handle arrays
13615
13616 var fiber = sourceFiber['return'];
13617 while (fiber !== null) {
13618 switch (fiber.tag) {
13619 case ClassComponent:
13620 var ctor = fiber.type;
13621 var instance = fiber.stateNode;
13622 if (typeof ctor.getDerivedStateFromCatch === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) {
13623 scheduleCapture(sourceFiber, fiber, value, expirationTime);
13624 return;
13625 }
13626 break;
13627 // TODO: Handle async boundaries
13628 case HostRoot:
13629 scheduleCapture(sourceFiber, fiber, value, expirationTime);
13630 return;
13631 }
13632 fiber = fiber['return'];
13633 }
13634
13635 if (sourceFiber.tag === HostRoot) {
13636 // Error was thrown at the root. There is no parent, so the root
13637 // itself should capture it.
13638 scheduleCapture(sourceFiber, sourceFiber, value, expirationTime);
13639 }
13640 }
13641
13642 function onCommitPhaseError(fiber, error) {
13643 return dispatch(fiber, error, Sync);

Callers 6

onCommitPhaseErrorFunction · 0.70
bindActionCreatorFunction · 0.70
replaceReducerFunction · 0.70
createStoreFunction · 0.70
app.jsFile · 0.70
app.jsxFile · 0.50

Calls 3

invariantFunction · 0.70
scheduleCaptureFunction · 0.70

Tested by

no test coverage detected