Skip to content

Commit 528e2f4

Browse files
committed
Fizz: Prevent UnhandledPromiseRejection if shell errors
1 parent 14c2be8 commit 528e2f4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/react-dom/src/server/ReactDOMFizzServerBrowser.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ function renderToReadableStream(
6767
resolve(stream);
6868
}
6969
function onShellError(error: mixed) {
70+
// If the shell errors the caller of `renderToReadableStream` won't have access to `allReady`.
71+
// However, `allReady` will be rejected by `onFatalError` as well.
72+
// So we need to catch the duplicate, uncatchable fatal error in `allReady` to prevent a `UnhandledPromiseRejection`.
73+
allReady.catch(() => {});
7074
reject(error);
7175
}
7276
const request = createRequest(

0 commit comments

Comments
 (0)