From 053fd6de9a254ae9617fdcef235f0698f6670c24 Mon Sep 17 00:00:00 2001 From: Matt Brophy Date: Tue, 7 Jul 2026 15:18:01 -0400 Subject: [PATCH] Revert "feat: add default web-streams based server entry (#14759)" (#15289) This reverts commit 2cc25c701b2c565180a600c820bf01ae903ad1da. --- .../framework-conventions/entry.server.tsx.md | 8 +- integration/defer-test.ts | 80 +++++------------ .../app}/entry.server.tsx | 15 +--- integration/link-test.ts | 5 +- integration/vite-plugin-cloudflare-test.ts | 19 +--- .../.changes/minor.web-streams-entry.md | 11 --- packages/react-router-dev/cli/commands.ts | 11 ++- packages/react-router-dev/config/config.ts | 8 +- .../config/defaults/entry.server.node.tsx | 86 +++++++++++++++++++ .../app/entry.server.tsx | 43 ++++++++++ 10 files changed, 179 insertions(+), 107 deletions(-) rename {packages/react-router-dev/config/defaults => integration/helpers/vite-plugin-cloudflare-template/app}/entry.server.tsx (79%) delete mode 100644 packages/react-router-dev/.changes/minor.web-streams-entry.md create mode 100644 packages/react-router-dev/config/defaults/entry.server.node.tsx create mode 100644 playground/vite-plugin-cloudflare/app/entry.server.tsx diff --git a/docs/api/framework-conventions/entry.server.tsx.md b/docs/api/framework-conventions/entry.server.tsx.md index cbad2a1c67..aa9e854162 100644 --- a/docs/api/framework-conventions/entry.server.tsx.md +++ b/docs/api/framework-conventions/entry.server.tsx.md @@ -145,9 +145,11 @@ _Note that you generally want to avoid logging when the request was aborted, sin **Streaming Rendering Errors** -When you are streaming your HTML responses via [`renderToReadableStream`][rendertoreadablestream], your own `handleError` implementation will only handle errors encountered during the initial shell render. If you encounter a rendering error during subsequent streamed rendering you will need to handle these errors manually since the React Router server has already sent the Response by that point. You can handle these errors in the `onError` callback function. +When you are streaming your HTML responses via [`renderToPipeableStream`][rendertopipeablestream] or [`renderToReadableStream`][rendertoreadablestream], your own `handleError` implementation will only handle errors encountered during the initial shell render. If you encounter a rendering error during subsequent streamed rendering you will need to handle these errors manually since the React Router server has already sent the Response by that point. -For an example, please refer to the default [`entry.server.tsx`][streaming-entry-server]. +For `renderToPipeableStream`, you can handle these errors in the `onError` callback function. You will need to toggle a boolean in `onShellReady` so you know if the error was a shell rendering error (and can be ignored) or an async + +For an example, please refer to the default [`entry.server.tsx`][node-streaming-entry-server] for Node. **Thrown Responses** @@ -158,5 +160,5 @@ Note that this does not handle thrown `Response` instances from your `loader`/`a [streaming]: ../../how-to/suspense [rendertopipeablestream]: https://react.dev/reference/react-dom/server/renderToPipeableStream [rendertoreadablestream]: https://react.dev/reference/react-dom/server/renderToReadableStream -[streaming-entry-server]: https://github.com/remix-run/react-router/blob/main/packages/react-router-dev/config/defaults/entry.server.tsx +[node-streaming-entry-server]: https://github.com/remix-run/react-router/blob/main/packages/react-router-dev/config/defaults/entry.server.node.tsx [templates-repo]: https://github.com/remix-run/react-router-templates diff --git a/integration/defer-test.ts b/integration/defer-test.ts index a016b6abb6..945683bce3 100644 --- a/integration/defer-test.ts +++ b/integration/defer-test.ts @@ -35,7 +35,7 @@ function counterHtml(id: string, val: number) { return `

${val}

`; } -const deferredHTMLStartString = '