-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Closed
Labels
Description
I'm using React Router as a...
library
Reproduction
React Router 6.29.0 - rerender issue (StackBlitz)
- Open the link.
- Wait until all dependencies are installed and the test is completed.
- Observe the error in the terminal.
The same behaviour is observed in browser. Example
- Open the link.
- Click
Update top state. - State outside the RouterProvider is
updated, but property in the component isinitial
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
npmPackages:
react: 18.2.0 => 18.2.0
react-dom: 18.2.0 => 18.2.0
react-router-dom: 6.29.0 => 6.29.0
webpack: ^5.38.1 => 5.72.0
webpack-cli: ^4.7.2 => 4.9.2
webpack-dev-server: ^3.11.2 => 3.11.3 Used Package Manager
npm
Expected Behavior
React Router 6.28.2 (StackBlitz)
I assume that the behavior in version 6.28.2 is expected.
It is expected that after the RouterProvider is rerendered, components that match the current state will also rerender and receive new props.
The same behavior is observed in the browser. Example
- Open the link.
- Click
Update top state. - State outside the RouterProvider and property in the component is
updated.
Actual Behavior
In version 6.29.0, after the RouterProvider is rerendered, the component does not receive new props.
It seems, this change was introduced in POC optimization for matchRoutes PR.