[Bug]: history.push results in empty search value

2
closed
D-Pagey
D-Pagey
Posted 1 month ago

[Bug]: history.push results in empty search value #8119

What version of React Router are you using?

5.3.0

Steps to Reproduce

  1. Navigate to any route with a query param in the url
  2. User click to navigate to a different url with a query parameter
history.push(`www.example.com/some/route?target=${uuid}`)
  1. The location.search field will be empty in the route despite being in the url

Screenshot 2021-10-08 at 11 06 45

Expected Behavior

The search field should be populated with ?target=dad... and not empty

Actual Behavior

The search field is empty

timdorr
timdorr
Created 1 month ago

I just tested this and it works fine. If you can recreate it on codesandbox, it's something we can look into. But I believe the issue isn't with the library.

D-Pagey
D-Pagey
Created 1 month ago

I don't understand why the search value would be empty when the pathname shows the query param. I couldn't find an explanation in the docs either.