You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When client-side navigating to a different route, the window.location property still holds the data for the previous route. This means that any components using this data display the incorrect value for the current route.
This can be worked around by putting the window.location call inside of a setTimeout with a delay of about 20ms, but this is a pretty non-ideal workaround
Go to index route.
Press "About" button to client-side navigate to the "about" route.
Observe "window.location.href" still being from the previous route (http://localhost:3000/)
Expected behavior
One would expect to see the location property being up-to-date with the current route.
Screenshots or Videos
Platform
OS: [e.g. macOS, Windows, Linux]
Browser: [e.g. Chrome, Safari, Firefox]
Version: [e.g. 91.1]
Additional context
No response
The text was updated successfully, but these errors were encountered:
Tommypop2
changed the title
window.location.href holds incorrect value on initial renderwindow.location holds incorrect value on initial render
May 26, 2024
Tommypop2
changed the title
window.location holds incorrect value on initial renderwindow.location holds incorrect value on initial client-side render
May 26, 2024
I think this is intentional - /about is evaluated before the navigation is finished, otherwise any resources the route might suspend on wouldn't be part of the navigation transition.
Describe the bug
When client-side navigating to a different route, the
window.location
property still holds the data for the previous route. This means that any components using this data display the incorrect value for the current route.This can be worked around by putting the
window.location
call inside of asetTimeout
with a delay of about 20ms, but this is a pretty non-ideal workaroundYour Example Website or App
https://github.com/Tommypop2/router-bug-repro
Steps to Reproduce the Bug or Issue
Go to index route.
Press "About" button to client-side navigate to the "about" route.
Observe "window.location.href" still being from the previous route (http://localhost:3000/)
Expected behavior
One would expect to see the location property being up-to-date with the current route.
Screenshots or Videos
Platform
Additional context
No response
The text was updated successfully, but these errors were encountered: