dillon1000/react
Commit
Browse files Move onCompleteAll to .allReady Promise (#24025)
* Move onCompleteAll to .allReady Promise The onCompleteAll callback can sometimes resolve before the promise that returns the stream which is tough to coordinate. A more idiomatic API for a one shot event is a Promise. That way the way you render for SEO or SSG is: const stream = await renderToReadableStream(...); await stream.readyAll; respondWith(stream); Ideally this should be a sub-class of ReadableStream but we don't yet compile these to ES6 and they'd had to be to native class to subclass a native stream. I have other ideas for overriding the .tee() method in a subclass anyway. So this is inline with that strategy. * Reject the Promise on fatal errors
Changed paths6 files
First-parent comparisonpackages/react-dom/src/__tests__/ReactDOMFizzServerBrowser-test.js ModifiedM packages/react-dom/src/server/ReactDOMFizzServerBrowser.js ModifiedM packages/react-dom/src/server/ReactDOMFizzServerNode.js ModifiedM packages/react-dom/src/server/ReactDOMLegacyServerBrowser.js ModifiedM packages/react-dom/src/server/ReactDOMLegacyServerNode.js ModifiedM packages/react-server/src/ReactFizzServer.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…