Skip to content

Commit

Permalink
Fizz: Prevent UnhandledPromiseRejection if shell errors (#24043)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Mar 8, 2022
1 parent d5f1b06 commit a59f53a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/react-dom/src/server/ReactDOMFizzServerBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ function renderToReadableStream(
resolve(stream);
}
function onShellError(error: mixed) {
// If the shell errors the caller of `renderToReadableStream` won't have access to `allReady`.
// However, `allReady` will be rejected by `onFatalError` as well.
// So we need to catch the duplicate, uncatchable fatal error in `allReady` to prevent a `UnhandledPromiseRejection`.
allReady.catch(() => {});
reject(error);
}
const request = createRequest(
Expand Down

0 comments on commit a59f53a

Please sign in to comment.