Skip to content

Using middleware causes route matching to break after updating from v7.9.1 to v7.9.2 #14390

@ceisele-r

Description

@ceisele-r

Reproduction

  1. Go to https://codesandbox.io/p/sandbox/react-router-v7-sy3yht
  2. View the Chrome Devtools for the preview stating {status: 404, statusText: 'Not Found', internal: true, data: 'Error: No route matches URL "/"', error: Error}
  3. Comment the line middleware: [anyMiddleware], out so no middleware is applied
  4. Reload the page -> Route matching works

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (22) x64 Intel(R) Core(TM) Ultra 9 185H
    Memory: 33.11 GB / 63.45 GB
  Binaries:
    Node: 22.20.0 - C:\Program Files\nodejs\node.EXE
    npm: 11.6.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 10.15.1 - ~\AppData\Roaming\npm\pnpm.CMD
  Browsers:
    Edge: Chromium (140.0.3485.54)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    react-router: ^7.9.2 => 7.9.2
    vite: ^7.1.7 => 7.1.7

However, seems unrelated to the specific system as it is reproducible in the CodeSandbox.

Used Package Manager

npm

Expected Behavior

Route matching also works as before in v7.9.1 when using a middleware.

Actual Behavior

Route matching fails for all routes after updating from v7.9.1 to v7.9.2 without changing any other code:

{status: 404, statusText: 'Not Found', internal: true, data: 'Error: No route matches URL "/"', error: Error}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions