-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling setQuery empties a location hash #229
Comments
Yeah that's very true. I made this change based on the way react-router works with search params (see this comment for their explanation on removing the hash). I don't necessarily agree with their reasoning, but I don't really use hashes myself very much to have a strong opinion. I'm unsure whether or not the provided adapter should do as you show above or not. |
@pbeshai I guess I also don't agree. |
Great fix, thanks for sharing! Totally agree that the hash shouldn't get nuked when search param changes happen. A lot of applications have tab components or other interactive UI elements that use URL hashes to target them, like going directly to a route with a specific tab selected when the page loads. For others needing to use this fix in their project locally:
|
Having the same issue with |
When we call
setQuery
our existing location hash will be emptied.https://codesandbox.io/s/use-query-params-issue-2eh8n7?file=/src/App.js
I tried to change, for instance,
ReactRouter5Adapter
to this and it likely solved this problem.The text was updated successfully, but these errors were encountered: