MCPcopy
hub / github.com/facebook/react / erroredReplay

Function erroredReplay

packages/react-server/src/ReactFizzServer.js:4406–4446  ·  view source on GitHub ↗
(
  request: Request,
  boundary: Root | SuspenseBoundary,
  error: mixed,
  errorInfo: ThrownInfo,
  replayNodes: ReplayNode[],
  resumeSlots: ResumeSlots,
  debugTask: null | ConsoleTask,
)

Source from the content-addressed store, hash-verified

4404}
4405
4406function erroredReplay(
4407 request: Request,
4408 boundary: Root | SuspenseBoundary,
4409 error: mixed,
4410 errorInfo: ThrownInfo,
4411 replayNodes: ReplayNode[],
4412 resumeSlots: ResumeSlots,
4413 debugTask: null | ConsoleTask,
4414): void {
4415 // Erroring during a replay doesn't actually cause an error by itself because
4416 // that component has already rendered. What causes the error is the resumable
4417 // points that we did not yet finish which will be below the point of the reset.
4418 // For example, if we're replaying a path to a Suspense boundary that is not done
4419 // that doesn't error the parent Suspense boundary.
4420 // This might be a bit strange that the error in a parent gets thrown at a child.
4421 // We log it only once and reuse the digest.
4422 let errorDigest;
4423 if (
4424 enablePostpone &&
4425 typeof error === 'object' &&
4426 error !== null &&
4427 error.$$typeof === REACT_POSTPONE_TYPE
4428 ) {
4429 const postponeInstance: Postpone = (error: any);
4430 logPostpone(request, postponeInstance.message, errorInfo, debugTask);
4431 // TODO: Figure out a better signal than a magic digest value.
4432 errorDigest = 'POSTPONE';
4433 } else {
4434 errorDigest = logRecoverableError(request, error, errorInfo, debugTask);
4435 }
4436 abortRemainingReplayNodes(
4437 request,
4438 boundary,
4439 replayNodes,
4440 resumeSlots,
4441 error,
4442 errorDigest,
4443 errorInfo,
4444 false,
4445 );
4446}
4447
4448function erroredTask(
4449 request: Request,

Callers 3

replayElementFunction · 0.85
replayFragmentFunction · 0.85
retryReplayTaskFunction · 0.85

Calls 3

logPostponeFunction · 0.70
logRecoverableErrorFunction · 0.70

Tested by

no test coverage detected