From 86e2f118b9d36abdd7208b51876d78a8d2017383 Mon Sep 17 00:00:00 2001 From: Sebastian Markbage Date: Sat, 17 Feb 2024 23:32:23 -0500 Subject: [PATCH] Recover from SSR error in Flight fixture --- fixtures/flight/server/global.js | 12 +++++++++++- fixtures/flight/server/region.js | 1 - 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/fixtures/flight/server/global.js b/fixtures/flight/server/global.js index 6e284e78d55ee..b6dc17e98b701 100644 --- a/fixtures/flight/server/global.js +++ b/fixtures/flight/server/global.js @@ -174,8 +174,18 @@ app.all('/', async function (req, res, next) { const {pipe} = renderToPipeableStream(React.createElement(Root), { bootstrapScripts: mainJSChunks, formState: formState, + onShellReady() { + pipe(res); + }, + onShellError(error) { + const {pipe: pipeError} = renderToPipeableStream( + React.createElement('html', null, React.createElement('body')), { + bootstrapScripts: mainJSChunks, + } + ); + pipeError(res); + } }); - pipe(res); } catch (e) { console.error(`Failed to SSR: ${e.stack}`); res.statusCode = 500; diff --git a/fixtures/flight/server/region.js b/fixtures/flight/server/region.js index e89f113b7cad6..0b9aae7b090b9 100644 --- a/fixtures/flight/server/region.js +++ b/fixtures/flight/server/region.js @@ -104,7 +104,6 @@ app.get('/', async function (req, res) { app.post('/', bodyParser.text(), async function (req, res) { const { - renderToPipeableStream, decodeReply, decodeReplyFromBusboy, decodeAction,