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

Function dispatch

code/communication/public/app.js:13395–13424  ·  view source on GitHub ↗
(sourceFiber, value, expirationTime)

Source from the content-addressed store, hash-verified

13393 }
13394
13395 function dispatch(sourceFiber, value, expirationTime) {
13396 !(!isWorking || isCommitting) ? invariant(false, 'dispatch: Cannot dispatch during the render phase.') : void 0;
13397
13398 // TODO: Handle arrays
13399
13400 var fiber = sourceFiber['return'];
13401 while (fiber !== null) {
13402 switch (fiber.tag) {
13403 case ClassComponent:
13404 var ctor = fiber.type;
13405 var instance = fiber.stateNode;
13406 if (typeof ctor.getDerivedStateFromCatch === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) {
13407 scheduleCapture(sourceFiber, fiber, value, expirationTime);
13408 return;
13409 }
13410 break;
13411 // TODO: Handle async boundaries
13412 case HostRoot:
13413 scheduleCapture(sourceFiber, fiber, value, expirationTime);
13414 return;
13415 }
13416 fiber = fiber['return'];
13417 }
13418
13419 if (sourceFiber.tag === HostRoot) {
13420 // Error was thrown at the root. There is no parent, so the root
13421 // itself should capture it.
13422 scheduleCapture(sourceFiber, sourceFiber, value, expirationTime);
13423 }
13424 }
13425
13426 function onCommitPhaseError(fiber, error) {
13427 return dispatch(fiber, error, Sync);

Callers 1

onCommitPhaseErrorFunction · 0.70

Calls 3

invariantFunction · 0.70
scheduleCaptureFunction · 0.70

Tested by

no test coverage detected