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

Function renderToStream

packages/react-server-dom-fb/src/ReactDOMServerFB.js:46–82  ·  view source on GitHub ↗
(children: ReactNodeList, options: Options)

Source from the content-addressed store, hash-verified

44};
45
46function renderToStream(children: ReactNodeList, options: Options): Stream {
47 const destination = {
48 buffer: '',
49 done: false,
50 fatal: false,
51 error: null,
52 };
53 const resumableState = createResumableState(
54 options ? options.identifierPrefix : undefined,
55 options ? options.unstable_externalRuntimeSrc : undefined,
56 options ? options.bootstrapScriptContent : undefined,
57 options ? options.bootstrapScripts : undefined,
58 options ? options.bootstrapModules : undefined,
59 );
60 const request = createRequest(
61 children,
62 resumableState,
63 createRenderState(
64 resumableState,
65 undefined,
66 options ? options.unstable_externalRuntimeSrc : undefined,
67 ),
68 createRootFormatContext(undefined),
69 options ? options.progressiveChunkSize : undefined,
70 options.onError,
71 undefined,
72 undefined,
73 );
74 startWork(request);
75 if (destination.fatal) {
76 throw destination.error;
77 }
78 return {
79 destination,
80 request,
81 };
82}
83
84function abortStream(stream: Stream, reason: mixed): void {
85 abort(stream.request, reason);

Callers 1

server.jsFile · 0.85

Calls 5

createResumableStateFunction · 0.90
createRequestFunction · 0.90
createRenderStateFunction · 0.90
createRootFormatContextFunction · 0.90
startWorkFunction · 0.90

Tested by

no test coverage detected