Skip to content

Parent clientLoader doesn't revalidate when a child route is changed #13264

Closed as not planned
@stevan-borus

Description

@stevan-borus

I'm using React Router as a...

framework

Reproduction

stackblitz repro

System Info

System:
    OS: macOS 15.3.2
    CPU: (8) arm64 Apple M1 Pro
    Memory: 216.94 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
Binaries:
    Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node
    npm: 10.9.0 - ~/.nvm/versions/node/v20.12.2/bin/npm
    pnpm: 10.5.0 - ~/Library/pnpm/pnpm
    Watchman: 2024.08.26.00 - /opt/homebrew/bin/watchman
Browsers:
    Chrome: 134.0.6998.89
    Edge: 134.0.3124.68
    Safari: 18.3.1
npmPackages:
    @react-router/dev: ^7.4.0 => 7.4.0 
    @react-router/node: ^7.4.0 => 7.4.0 
    react-router: ^7.4.0 => 7.4.0 
    vite: ^6.2.2 => 6.2.2

Used Package Manager

pnpm

Expected Behavior

The parent clientLoader should always revalidate when its child route is changed, without setting shouldRevalidate = () => true;

Actual Behavior

In the repro, v7.1.5 is set and for that version, the parent clientLoader revalidates when the child route is changed by clicking on one of the links in the parent component, so the selected link which is set in the parent clientLoader can also change

In later versions, the parent clientLoader only revalidates when shouldRevalidate is explicitly set to true
shouldRevalidate = () => true;

This is happening when ssr: false

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