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
This isn't a bug with the library. If React is flushing things to the DOM too quickly, that seems to be an issue on their end. Nonetheless, you are using an older version of React so bugs should be expected.
If I understand correctly, the substance of the complaint is
the value of window.location.search is always stale value:?status=1
In other words, after calling navigate('/list?status=2') the ?statusin the URL bar (as given by window.location) is still 1. This seems to imply that it's the URL navigation that has not been flushed. I assume it's controlled by the router (unless React is forgetting to call some Effect?). I don't see how React flushing to the DOM is relevant here yet.
What version of React Router are you using?
6.9.0
Steps to Reproduce
React 16.14.0 reproducible example:
codesandbox
React 18.2.0 working example:
stackblitz
Expected Behavior
The value of
window.location.search
should be synchronized withuseLocation().search
, that is?status=2
.Actual Behavior
Using the
navigate()
to replace the url search parameter.When the route is
/list?status=1
, output:After calling
navigate('/list?status=2')
, output:As you can see, the value of
window.location.search
is always stale value:?status=1
The text was updated successfully, but these errors were encountered: