Skip to content

Updating the router when rerendering does not update rendered routes #13295

@seriousManual

Description

@seriousManual

I'm using React Router as a...

library

Reproduction

Bug Report

reproduction

Go to:
https://stackblitz.com/edit/react-router-bug-repro?file=app%2Froot.tsx,vite.config.ts,package.json,index.html

  • click "a" -> shows "unauthorized"
  • click "b" -> shows "B Content"
  • click "home" -> shows "Home"

all good. 👍

  • click "a"
  • click "set authorized"
    simulates a deferred authorization that influences how routes are displayed.
    expected: "unauthorized" changes to "A Content"
    actual: "unauthorized" stays
  • navigate to "home" and back to "a":
    "A Content" is shown

This worked with 6.22 but did not anymore when we upgraded to 6.30.
Still existing after upgrade to v7

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @react-router/dev: * => 7.4.0 
    @react-router/node: * => 7.4.0 
    @react-router/serve: * => 7.4.0 
    react-router: * => 7.4.0 
    vite: ^6.0.11 => 6.2.2

Used Package Manager

npm

Expected Behavior

see reproduction

Actual Behavior

see reproduction

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