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

Function onShellReady

packages/react-dom/src/server/ReactDOMFizzServerNode.js:223–246  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

221 });
222
223 function onShellReady() {
224 let writable: Writable;
225 const stream: ReactDOMServerReadableStream = (new ReadableStream(
226 {
227 type: 'bytes',
228 start: (controller): ?Promise<void> => {
229 writable =
230 createFakeWritableFromReadableStreamController(controller);
231 },
232 pull: (controller): ?Promise<void> => {
233 startFlowing(request, writable);
234 },
235 cancel: (reason): ?Promise<void> => {
236 stopFlowing(request);
237 abort(request, reason);
238 },
239 },
240 // $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
241 {highWaterMark: 0},
242 ): any);
243 // TODO: Move to sub-classing ReadableStream.
244 stream.allReady = allReady;
245 resolve(stream);
246 }
247 function onShellError(error: mixed) {
248 // If the shell errors the caller of `renderToReadableStream` won't have access to `allReady`.
249 // However, `allReady` will be rejected by `onFatalError` as well.

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected