URL query compatibility with react-router routes and location #1059

Closed
opened 2025-08-09 17:18:43 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @peterlazzarino on 2/2/2017

I've been using asp prerendering for an application that uses the query string to for fetching data that I want rendered on the server. I noticed while following the react example that the query string was being encoded incorrectly but only on the server side when the location is created in createServerRenderer and then passed into react router.

I traced it to react-router and creatememoryhistory expecting the query field on the location object to be a key value pair object and not a string like it is in the createserverrenderer params. Since you are using url.parse and there is an option to pass true for it be an object, can this be exposed as a parameter somewhere? Using this allows me to use the query on the server and client. I'm not sure of the implications of switching this to true and then submitting a PR.

*Originally created by @peterlazzarino on 2/2/2017* I've been using asp prerendering for an application that uses the query string to for fetching data that I want rendered on the server. I noticed while following the react example that the query string was being encoded incorrectly but only on the server side when the location is created in createServerRenderer and then passed into react router. I traced it to react-router and creatememoryhistory expecting the query field on the location object to be a key value pair object and not a string like it is in the createserverrenderer params. Since you are using url.parse and there is an option to pass true for it be an object, can this be exposed as a parameter somewhere? Using this allows me to use the query on the server and client. I'm not sure of the implications of switching this to true and then submitting a PR.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#1059
No description provided.