Skip to content

Middleware is interfering with shouldRevalidate #14257

@DiederikvandenB

Description

@DiederikvandenB

Reproduction

https://stackblitz.com/edit/github-g8dxfe6q-pglgvmkd?file=react-router.config.ts

Changing the value of unstable_middleware to true results in the parent-loader to always fire. When middleware is disabled, it only fires on the initial page load.

System Info

System:
    OS: macOS 15.6.1
    CPU: (14) arm64 Apple M3 Max
    Memory: 404.39 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.4.0 - /opt/homebrew/bin/node
    npm: 11.4.2 - /opt/homebrew/bin/npm
    pnpm: 10.6.2 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 139.0.7258.139
    Edge: 139.0.3405.119
    Safari: 18.6
  npmPackages:
    @react-router/dev: ^7.8.2 => 7.8.2 
    @react-router/node: ^7.8.2 => 7.8.2 
    @react-router/serve: ^7.8.2 => 7.8.2 
    react-router: ^7.8.2 => 7.8.2 
    vite: ^6.3.3 => 6.3.5

Used Package Manager

pnpm

Expected Behavior

Clicking the "Go to next child" link should not trigger a revalidation of the parent-loader

Actual Behavior

The parent-loader is being revalidated, as can be seen in the terminal console.logs

Important: this behavior only occurs when unstable_middleware is set to true in react-router.config.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions