From 5662857616f7d645d3f7f5d4709c5bc36c660fcf Mon Sep 17 00:00:00 2001 From: salazarm Date: Thu, 3 Mar 2022 12:02:37 -0500 Subject: [PATCH] [Fizz] Export debug function for FB (#24024) * export debug function for FB * silence flow --- .../src/ReactDOMServerFB.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/react-server-dom-relay/src/ReactDOMServerFB.js b/packages/react-server-dom-relay/src/ReactDOMServerFB.js index 35a8143125d74..0d7aeef6cbd4f 100644 --- a/packages/react-server-dom-relay/src/ReactDOMServerFB.js +++ b/packages/react-server-dom-relay/src/ReactDOMServerFB.js @@ -92,4 +92,17 @@ function hasFinished(stream: Stream): boolean { return stream.destination.done; } -export {renderToStream, renderNextChunk, hasFinished, abortStream}; +function debug(stream: Stream): any { + // convert to any to silence flow errors from opaque type + const request = (stream.request: any); + return { + pendingRootTasks: request.pendingRootTasks, + clientRenderedBoundaries: request.clientRenderedBoundaries.length, + completedBoundaries: request.completedBoundaries.length, + partialBoundaries: request.partialBoundaries.length, + allPendingTasks: request.allPendingTasks, + pingedTasks: request.pingedTasks.length, + }; +} + +export {renderToStream, renderNextChunk, hasFinished, abortStream, debug};