@samitouri / QOS-React-2 / commits / 4bc465a16f

Rename Controls to PipeableStream (#24286)

This type isn't exported so it's technically not public. This object mimics a ReadableStream. Currently this is safe to destructure and call separately but I'm not sure that's even guaranteed. It should probably be treated as a class in docs.

Sebastian Markbåge committed Apr 6, 2022 at 19:27 UTC 4bc465a16f3270283886221604c1187fc976859b
2 files changed +4 -4
packages/react-dom/src/server/ReactDOMFizzServerNode.js
+2 -2
@@ -46,7 +46,7 @@ type Options = {|
46 onError?: (error: mixed) => void,
47 |};
48
49 -type Controls = {|
49 +type PipeableStream = {|
50 // Cancel any pending I/O and put anything remaining into
51 // client rendered mode.
52 abort(): void,
@@ -76,7 +76,7 @@ function createRequestImpl(children: ReactNodeList, options: void | Options) {
76 function renderToPipeableStream(
77 children: ReactNodeList,
78 options?: Options,
79 -): Controls {
79 +): PipeableStream {
80 const request = createRequestImpl(children, options);
81 let hasStartedFlowing = false;
82 startWork(request);
packages/react-server-dom-webpack/src/ReactFlightDOMServerNode.js
+2 -2
@@ -26,7 +26,7 @@ type Options = {
26 onError?: (error: mixed) => void,
27 };
28
29 -type Controls = {|
29 +type PipeableStream = {|
30 pipe<T: Writable>(destination: T): T,
31 |};
32
@@ -35,7 +35,7 @@ function renderToPipeableStream(
35 webpackMap: BundlerConfig,
36 options?: Options,
37 context?: Array<[string, ServerContextJSONValue]>,
38 -): Controls {
38 +): PipeableStream {
39 const request = createRequest(
40 model,
41 webpackMap,