From 35f1d0f86d27c84a702a0f1417a0c389f5ddc822 Mon Sep 17 00:00:00 2001 From: Sebastian Markbage Date: Wed, 4 Oct 2023 00:18:23 -0400 Subject: [PATCH] Resolve shell when a replay task errors --- .../src/__tests__/ReactDOMFizzStaticBrowser-test.js | 7 ++++++- packages/react-server/src/ReactFizzServer.js | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzStaticBrowser-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzStaticBrowser-test.js index facfee69ad6f3..f5cdd6c7450f9 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzStaticBrowser-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzStaticBrowser-test.js @@ -996,6 +996,11 @@ describe('ReactDOMFizzStaticBrowser', () => { return children; } + const lazySpan = React.lazy(async () => { + await 0; + return {default: }; + }); + function App() { const children = ( @@ -1013,7 +1018,7 @@ describe('ReactDOMFizzStaticBrowser', () => { ) : ( - + lazySpan )} diff --git a/packages/react-server/src/ReactFizzServer.js b/packages/react-server/src/ReactFizzServer.js index c44f9a2e6e1f8..ce2a1b0931f2c 100644 --- a/packages/react-server/src/ReactFizzServer.js +++ b/packages/react-server/src/ReactFizzServer.js @@ -3464,6 +3464,12 @@ function retryReplayTask(request: Request, task: ReplayTask): void { task.replay.nodes, task.replay.slots, ); + request.pendingRootTasks--; + if (request.pendingRootTasks === 0) { + request.onShellError = noop; + const onShellReady = request.onShellReady; + onShellReady(); + } request.allPendingTasks--; if (request.allPendingTasks === 0) { const onAllReady = request.onAllReady;