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

Function onShellReady

packages/react-dom/src/server/ReactDOMFizzServerEdge.js:93–111  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91 });
92
93 function onShellReady() {
94 const stream: ReactDOMServerReadableStream = (new ReadableStream(
95 {
96 type: 'bytes',
97 pull: (controller): ?Promise<void> => {
98 startFlowing(request, controller);
99 },
100 cancel: (reason): ?Promise<void> => {
101 stopFlowing(request);
102 abort(request, reason);
103 },
104 },
105 // $FlowFixMe[prop-missing] size() methods are not allowed on byte streams.
106 {highWaterMark: 0},
107 ): any);
108 // TODO: Move to sub-classing ReadableStream.
109 stream.allReady = allReady;
110 resolve(stream);
111 }
112 function onShellError(error: mixed) {
113 // If the shell errors the caller of `renderToReadableStream` won't have access to `allReady`.
114 // However, `allReady` will be rejected by `onFatalError` as well.

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected