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

Function onShellReady

packages/react-dom/src/server/ReactDOMFizzServerBun.js:77–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

75 });
76
77 function onShellReady() {
78 const stream: ReactDOMServerReadableStream = (new ReadableStream(
79 {
80 type: 'direct',
81 pull: (controller): ?Promise<void> => {
82 // $FlowIgnore
83 startFlowing(request, controller);
84 },
85 cancel: (reason): ?Promise<void> => {
86 stopFlowing(request);
87 abort(request, reason);
88 },
89 },
90 // $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
91 {highWaterMark: 2048},
92 ): any);
93 // TODO: Move to sub-classing ReadableStream.
94 stream.allReady = allReady;
95 resolve(stream);
96 }
97 function onShellError(error: mixed) {
98 // If the shell errors the caller of `renderToReadableStream` won't have access to `allReady`.
99 // However, `allReady` will be rejected by `onFatalError` as well.

Callers 1

completeShellFunction · 0.50

Calls 4

startFlowingFunction · 0.90
stopFlowingFunction · 0.90
abortFunction · 0.90
resolveFunction · 0.50

Tested by

no test coverage detected