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

Function dispatch

code/styling/public/app.js:13360–13389  ·  view source on GitHub ↗
(sourceFiber, value, expirationTime)

Source from the content-addressed store, hash-verified

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

Callers 1

onCommitPhaseErrorFunction · 0.70

Calls 3

invariantFunction · 0.70
scheduleCaptureFunction · 0.70

Tested by

no test coverage detected