-
Notifications
You must be signed in to change notification settings - Fork 98
Description
I'm having trouble getting use-query-params
to correctly fetch query param values on a Server Side Render. We are using <StaticRouter>
from react-router-dom
, initialised as is standard with the known value of location
from the request.
Looking at the source here it seems that the assumption is being made that on a SSR the query must be extracted from location.pathname
rather than from location.search
. However AFAICT <StaticRouter>
puts the query string in location.search
consistent with <BrowserRouter>
.
It seems like it might make more sense just to test directly for the presence of location.search
and only fallback to parsing pathname
if the former is missing, rather than checking for window
? (although I'm not sure if this approach would be compatible with other routing frameworks...)
I will in the meantime workaround this using rawQuery
but it'd be nice for it to work out of the box to reduce complexity and allow us to phase out other query string related packages completely in favour of just using this.
Cheers.