Skip to content

Middleware isn't being run in createRoutesStub (memory router?) #14344

@silvenon

Description

@silvenon

Reproduction

https://github.com/silvenon/repro/tree/react-router-stub-middleware

# with GitHub CLI
gh repo clone silvenon/repro -b react-router-stub-middleware
cd repro
npm install
npm test

System Info

System:
    OS: macOS 15.6.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 190.75 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.19.0 - ~/.n/bin/node
    Yarn: 1.22.19 - ~/.n/bin/yarn
    npm: 10.9.3 - ~/.n/bin/npm
    pnpm: 7.0.0 - ~/.n/bin/pnpm
    bun: 1.1.29 - ~/.bun/bin/bun
  Browsers:
    Brave Browser: 133.1.75.181
    Chrome: 140.0.7339.133
    Edge: 140.0.3485.66
    Safari: 18.6
  npmPackages:
    react-router: ^7.9.1 => 7.9.1

Used Package Manager

npm

Expected Behavior

Considering that middleware has been stabilized I expected it to also run in createRoutesStub, i.e. memory router. I don't consider (server) middleware to be something outside the scope of testing, and without this the stub is unusable.

Actual Behavior

Middleware doesn't run in stubs. Are there plans to add it to the memory router, if this is the root issue?

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