77 * @flow
88 */
99
10- import type {
11- Request ,
12- PostponedState ,
13- HeadersDescriptor ,
14- } from 'react-server/src/ReactFizzServer' ;
10+ import type { Request , PostponedState } from 'react-server/src/ReactFizzServer' ;
1511import type { ReactNodeList , ReactFormState } from 'shared/ReactTypes' ;
1612import type { Writable } from 'stream' ;
17- import type { BootstrapScriptDescriptor } from 'react-dom-bindings/src/server/ReactFizzConfigDOM' ;
13+ import type {
14+ BootstrapScriptDescriptor ,
15+ HeadersDescriptor ,
16+ } from 'react-dom-bindings/src/server/ReactFizzConfigDOM' ;
1817import type { Destination } from 'react-server/src/ReactServerStreamConfigNode' ;
1918import type { ImportMap } from '../shared/ReactDOMTypes' ;
2019
@@ -27,6 +26,7 @@ import {
2726 startFlowing ,
2827 stopFlowing ,
2928 abort ,
29+ prepareForStartFlowingIfBeforeAllReady ,
3030} from 'react-server/src/ReactFizzServer' ;
3131
3232import {
@@ -65,6 +65,7 @@ type Options = {
6565 importMap ?: ImportMap ,
6666 formState ?: ReactFormState < any , any> | null ,
6767 onHeaders ?: ( headers : HeadersDescriptor ) => void ,
68+ maxHeadersLength ? : number ,
6869} ;
6970
7071type ResumeOptions = {
@@ -99,6 +100,8 @@ function createRequestImpl(children: ReactNodeList, options: void | Options) {
99100 options ? options . bootstrapModules : undefined ,
100101 options ? options . unstable_externalRuntimeSrc : undefined ,
101102 options ? options . importMap : undefined ,
103+ options ? options . onHeaders : undefined ,
104+ options ? options . maxHeadersLength : undefined ,
102105 ) ,
103106 createRootFormatContext ( options ? options . namespaceURI : undefined ) ,
104107 options ? options . progressiveChunkSize : undefined ,
@@ -109,7 +112,6 @@ function createRequestImpl(children: ReactNodeList, options: void | Options) {
109112 undefined ,
110113 options ? options . onPostpone : undefined ,
111114 options ? options . formState : undefined ,
112- options ? options . onHeaders : undefined ,
113115 ) ;
114116}
115117
@@ -128,6 +130,7 @@ function renderToPipeableStream(
128130 ) ;
129131 }
130132 hasStartedFlowing = true;
133+ prepareForStartFlowingIfBeforeAllReady(request);
131134 startFlowing(request, destination);
132135 destination.on('drain', createDrainHandler(destination, request));
133136 destination.on(
0 commit comments