#15556·react-router

Fetcher-triggered route discovery on a manifest version mismatch reloads the current URL and drops a pending navigation

Author: loveladyCreated Sep 25, 2026Updated Sep 28, 2026
Labelspkg:@react-router/devfeat:lazy-route-discovery

Reproduction

There is no hosted reproduction yet. The mechanism is visible in the source, and it reproduces in any framework-mode app that uses the default lazy route discovery:

  1. Load /. Route /b is already discovered, for example through a rendered <Link to="/b">. Route /undiscovered is not.
  2. Change the manifest version: deploy a new build, or in development edit a route module's exports.
  3. Start a navigation to /b, for example by submitting a GET <Form action="/b"> or calling navigate("/b"). While its loader is still in flight, start a fetcher whose route needs discovery, such as fetcher.load("/undiscovered").
  4. The fetcher's /__manifest request gets 204 with X-Remix-Reload-Document, because the version is stale.

System Info

react-router 8.3.1 (framework mode, SSR, default lazy route discovery)
Chromium, Node 22

Used Package Manager

pnpm

Expected Behavior

The hard reload targets the pending navigation's location (/b), as it already does for navigation-triggered discovery, so the user's navigation still lands after the reload. A navigation that can't be replayed, such as a POST submission, could keep today's fallback to the current URL.

Actual Behavior

The document reloads to the current URL (/), and the pending navigation to /b is dropped. That happens even if /b's loader has already answered.

getPatchRoutesOnNavigationFunction passes the current URL as the reload path whenever the discovery comes from a fetcher (dist/development/lib/dom/ssr/fog-of-war.js:57):

javascript
await fetchAndApplyManifestPatches(
  [path],
  fetcherKey ? window.location.href : createPath(state.navigation.location || state.location),
  …
)

handleClientVersionMismatch then sets window.location.href to that path and awaits a promise that never settles (fog-of-war.js:102-104). Nothing brings the in-flight navigation back after the reload.

Real-world symptom: after a deploy, a user with an open page types into a search box that loads suggestions through a fetcher, presses Enter (a GET navigation to /search), and lands back on the page they started from, with the search lost. The suggestion fetcher's route discovery is what triggers the reload. Our workaround is to discover the fetcher's route along with the page (<Link discover="render">), so typing never needs a discovery request.

Possible fix: when fetcherKey is set and state.navigation.state !== "idle" with a GET formMethod (or no form), reload to createPath(state.navigation.location). Otherwise keep window.location.href.