You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
URL query compatibility with react-router routes and location #638
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.
Also wanted to mention that when using createserverrenderer with react-router the string encoding of the querystring caused the issue inside of creatememoryhistory when it called the defaultStringifyQuery method of useQueries which calls query-string.stringify which is the method that expects the query object.
Thanks for the suggestion! I've updated aspnet-prerendering to version 2.0.3, which does parse the querystring in the way you've requested. This should make the server-side and client-side routing behaviours consistent.
Activity
peterlazzarino commentedon Feb 2, 2017
Also wanted to mention that when using createserverrenderer with react-router the string encoding of the querystring caused the issue inside of creatememoryhistory when it called the defaultStringifyQuery method of useQueries which calls query-string.stringify which is the method that expects the query object.
Hope this all makes sense haha
SteveSandersonMS commentedon Feb 3, 2017
Thanks for the suggestion! I've updated
aspnet-prerenderingto version 2.0.3, which does parse the querystring in the way you've requested. This should make the server-side and client-side routing behaviours consistent.