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

Function resumeRequest

packages/react-server/src/ReactFizzServer.js:644–738  ·  view source on GitHub ↗
(
  children: ReactNodeList,
  postponedState: PostponedState,
  renderState: RenderState,
  onError: void | ((error: mixed, errorInfo: ErrorInfo) => ?string),
  onAllReady: void | (() => void),
  onShellReady: void | (() => void),
  onShellError: void | ((error: mixed) => void),
  onFatalError: void | ((error: mixed) => void),
  onPostpone: void | ((reason: string, postponeInfo: PostponeInfo) => void),
)

Source from the content-addressed store, hash-verified

642}
643
644export function resumeRequest(
645 children: ReactNodeList,
646 postponedState: PostponedState,
647 renderState: RenderState,
648 onError: void | ((error: mixed, errorInfo: ErrorInfo) => ?string),
649 onAllReady: void | (() => void),
650 onShellReady: void | (() => void),
651 onShellError: void | ((error: mixed) => void),
652 onFatalError: void | ((error: mixed) => void),
653 onPostpone: void | ((reason: string, postponeInfo: PostponeInfo) => void),
654): Request {
655 if (__DEV__) {
656 resetOwnerStackLimit();
657 }
658
659 // $FlowFixMe[invalid-constructor]: the shapes are exact here but Flow doesn't like constructors
660 const request: Request = new RequestInstance(
661 postponedState.resumableState,
662 renderState,
663 postponedState.rootFormatContext,
664 postponedState.progressiveChunkSize,
665 onError,
666 onAllReady,
667 onShellReady,
668 onShellError,
669 onFatalError,
670 onPostpone,
671 null,
672 );
673 request.nextSegmentId = postponedState.nextSegmentId;
674
675 if (typeof postponedState.replaySlots === 'number') {
676 // We have a resume slot at the very root. This is effectively just a full rerender.
677 const rootSegment = createPendingSegment(
678 request,
679 0,
680 null,
681 postponedState.rootFormatContext,
682 // Root segments are never embedded in Text on either edge
683 false,
684 false,
685 );
686 // There is no parent so conceptually, we're unblocked to flush this segment.
687 rootSegment.parentFlushed = true;
688 const rootTask = createRenderTask(
689 request,
690 null,
691 children,
692 -1,
693 null,
694 rootSegment,
695 null,
696 null,
697 request.abortableTasks,
698 null,
699 postponedState.rootFormatContext,
700 rootContextSnapshot,
701 emptyTreeContext,

Callers 5

resumeFunction · 0.90
resumeFunction · 0.90
resumeRequestImplFunction · 0.90
resumeFunction · 0.90

Calls 6

resetOwnerStackLimitFunction · 0.90
createPendingSegmentFunction · 0.85
createRenderTaskFunction · 0.85
pushComponentStackFunction · 0.85
createReplayTaskFunction · 0.85
pushMethod · 0.65

Tested by

no test coverage detected