Skip to content

fix: patch react-router 8.4.0 so an aborted request cannot stop the server - #5

Merged
Mheaus merged 1 commit into
mainfrom
fix/patch-react-router-abort-crash
Oct 9, 2026
Merged

Mheaus merged 1 commit into
mainfrom
fix/patch-react-router-abort-crash

Conversation

@Mheaus

@Mheaus Mheaus commented Oct 9, 2026

Copy link
Copy Markdown
Member

Why

In RSC mode, react-router 8.4.0 can stop the Node process when a client aborts a document request (TypeError: Invalid state: Unable to enqueue, unhandled rejection). Reported upstream as remix-run/react-router#15611, with a proposed fix in remix-run/react-router#15612.

What changes

  • patches/react-router@8.4.0.patch (pnpm patch): the exact fix from fix(react-router): stop the RSC HTML stream when it is cancelled during flush remix-run/react-router#15612, as React Router's build emits it, in dist/{development,production}/lib/rsc/html-stream/server.js. No other file of the package changes.
  • pnpm-workspace.yaml: patchedDependencies, so the demo, the bench and CI use the patched build.
  • README: apps that use the adapter must apply the same patch. The patch is not shipped in the npm package (files is dist only), so the README explains how to add it.

Remove the patch when a React Router release contains the fix.

Verification

Production build of demo/, react-router-serve, one request at a time that the client aborts after 1–9 ms (/ answers in about 6 ms), capped at 300:

Build Trials Server stopped Aborted requests until it stopped
without the patch 3 3 1, 2, 1
with the patch 3 0 survived 300

pnpm install --frozen-lockfile, the library build and the demo build pass with the patch.

@Mheaus
Mheaus merged commit 3b207a8 into main Oct 9, 2026
3 checks passed
@Mheaus
Mheaus deleted the fix/patch-react-router-abort-crash branch October 9, 2026 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant