Closed
Description
Reproduction
code: https://github.com/bb-in-hoodie/react-router-use-effect-issue
- let's say the first page is called Page1
- in Page1, navigate to Page2 in useEffect
- in Page2, press back button of the browser
[the initial tab page of a browser] → access the server → [first page] → useEffect + navigate → [second page] → press back button of the browser → ???
System Info
- tested on the latest chrome and safari in mac
- react router 7.5.3 and older
Used Package Manager
pnpm
Expected Behavior
- goes back to the first page
Actual Behavior
- goes back to the initial tab, skipping the first page
- even though there still is a record of the first page observable on the browser history (by right clicking on the back button)