From 4bc465a16f3270283886221604c1187fc976859b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Markb=C3=A5ge?= Date: Wed, 6 Apr 2022 19:27:38 -0400 Subject: [PATCH] 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. --- packages/react-dom/src/server/ReactDOMFizzServerNode.js | 4 ++-- .../react-server-dom-webpack/src/ReactFlightDOMServerNode.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/react-dom/src/server/ReactDOMFizzServerNode.js b/packages/react-dom/src/server/ReactDOMFizzServerNode.js index 306724c448b0f..efc6cd817b057 100644 --- a/packages/react-dom/src/server/ReactDOMFizzServerNode.js +++ b/packages/react-dom/src/server/ReactDOMFizzServerNode.js @@ -46,7 +46,7 @@ type Options = {| onError?: (error: mixed) => void, |}; -type Controls = {| +type PipeableStream = {| // Cancel any pending I/O and put anything remaining into // client rendered mode. abort(): void, @@ -76,7 +76,7 @@ function createRequestImpl(children: ReactNodeList, options: void | Options) { function renderToPipeableStream( children: ReactNodeList, options?: Options, -): Controls { +): PipeableStream { const request = createRequestImpl(children, options); let hasStartedFlowing = false; startWork(request); diff --git a/packages/react-server-dom-webpack/src/ReactFlightDOMServerNode.js b/packages/react-server-dom-webpack/src/ReactFlightDOMServerNode.js index c088725f25909..76952b6d54258 100644 --- a/packages/react-server-dom-webpack/src/ReactFlightDOMServerNode.js +++ b/packages/react-server-dom-webpack/src/ReactFlightDOMServerNode.js @@ -26,7 +26,7 @@ type Options = { onError?: (error: mixed) => void, }; -type Controls = {| +type PipeableStream = {| pipe(destination: T): T, |}; @@ -35,7 +35,7 @@ function renderToPipeableStream( webpackMap: BundlerConfig, options?: Options, context?: Array<[string, ServerContextJSONValue]>, -): Controls { +): PipeableStream { const request = createRequest( model, webpackMap,