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

Function dispatch

code/higher-order-components/public/app.js:13354–13383  ·  view source on GitHub ↗
(sourceFiber, value, expirationTime)

Source from the content-addressed store, hash-verified

13352 }
13353
13354 function dispatch(sourceFiber, value, expirationTime) {
13355 !(!isWorking || isCommitting) ? invariant(false, 'dispatch: Cannot dispatch during the render phase.') : void 0;
13356
13357 // TODO: Handle arrays
13358
13359 var fiber = sourceFiber['return'];
13360 while (fiber !== null) {
13361 switch (fiber.tag) {
13362 case ClassComponent:
13363 var ctor = fiber.type;
13364 var instance = fiber.stateNode;
13365 if (typeof ctor.getDerivedStateFromCatch === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) {
13366 scheduleCapture(sourceFiber, fiber, value, expirationTime);
13367 return;
13368 }
13369 break;
13370 // TODO: Handle async boundaries
13371 case HostRoot:
13372 scheduleCapture(sourceFiber, fiber, value, expirationTime);
13373 return;
13374 }
13375 fiber = fiber['return'];
13376 }
13377
13378 if (sourceFiber.tag === HostRoot) {
13379 // Error was thrown at the root. There is no parent, so the root
13380 // itself should capture it.
13381 scheduleCapture(sourceFiber, sourceFiber, value, expirationTime);
13382 }
13383 }
13384
13385 function onCommitPhaseError(fiber, error) {
13386 return dispatch(fiber, error, Sync);

Callers 1

onCommitPhaseErrorFunction · 0.70

Calls 3

invariantFunction · 0.70
scheduleCaptureFunction · 0.70

Tested by

no test coverage detected