-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Closed
Labels
Description
What version of React Router are you using?
6.4.0-pre.8
Steps to Reproduce
Sandbox demonstrating the unexpected behavior could be found below
https://codesandbox.io/s/boring-banach-ri3tiv?file=/src/App.js
The behavior is erratic only if I have a basename="assets"
as a BrowserRouter Prop. If I remove the basename
prop, normal functionality is restored
Expected Behavior
When I do setSearchParams( {foo:'bar'} ) when on url path basename/id1
, the url should get changed to basename/id1?foo=bar
Actual Behavior
When I do setSearchParams( {foo:'bar'} ) when on url path basename/id1
, the url is changed to basename?foo=bar
For eg, in the sandbox:
https://codesandbox.io/s/boring-banach-ri3tiv?file=/src/App.js
Sandbox Steps:
- When on url
/assets
Click on the button 'Click me!' - That should take you to /assets/id1, now click on the button 'Button One'
Notice how the url changes to assets?buttonone=test and not assets/id1?buttonone=test