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

Function createRequest

packages/react-server/src/ReactFizzServer.js:539–606  ·  view source on GitHub ↗
(
  children: ReactNodeList,
  resumableState: ResumableState,
  renderState: RenderState,
  rootFormatContext: FormatContext,
  progressiveChunkSize: void | number,
  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),
  formState: void | null | ReactFormState<any, any>,
)

Source from the content-addressed store, hash-verified

537}
538
539export function createRequest(
540 children: ReactNodeList,
541 resumableState: ResumableState,
542 renderState: RenderState,
543 rootFormatContext: FormatContext,
544 progressiveChunkSize: void | number,
545 onError: void | ((error: mixed, errorInfo: ErrorInfo) => ?string),
546 onAllReady: void | (() => void),
547 onShellReady: void | (() => void),
548 onShellError: void | ((error: mixed) => void),
549 onFatalError: void | ((error: mixed) => void),
550 onPostpone: void | ((reason: string, postponeInfo: PostponeInfo) => void),
551 formState: void | null | ReactFormState<any, any>,
552): Request {
553 if (__DEV__) {
554 resetOwnerStackLimit();
555 }
556
557 // $FlowFixMe[invalid-constructor]: the shapes are exact here but Flow doesn't like constructors
558 const request: Request = new RequestInstance(
559 resumableState,
560 renderState,
561 rootFormatContext,
562 progressiveChunkSize,
563 onError,
564 onAllReady,
565 onShellReady,
566 onShellError,
567 onFatalError,
568 onPostpone,
569 formState,
570 );
571
572 // This segment represents the root fallback.
573 const rootSegment = createPendingSegment(
574 request,
575 0,
576 null,
577 rootFormatContext,
578 // Root segments are never embedded in Text on either edge
579 false,
580 false,
581 );
582 // There is no parent so conceptually, we're unblocked to flush this segment.
583 rootSegment.parentFlushed = true;
584 const rootTask = createRenderTask(
585 request,
586 null,
587 children,
588 -1,
589 null,
590 rootSegment,
591 null,
592 null,
593 request.abortableTasks,
594 null,
595 rootFormatContext,
596 rootContextSnapshot,

Callers 8

renderToStreamFunction · 0.90
renderToReadableStreamFunction · 0.90
renderToReadableStreamFunction · 0.90
renderToReadableStreamFunction · 0.90
renderToStringImplFunction · 0.90
createRequestImplFunction · 0.90
renderToReadableStreamFunction · 0.90
createPrerenderRequestFunction · 0.70

Calls 5

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

Tested by

no test coverage detected