NextJS doesn't support parsing nested objects in query parameters
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior
Expected at least nested objects be supported and parsed correctly from query
Current Behavior
It takes the whole thing as a key, instead of creating an nested object
Doesn’t matter the format, none of them works
/?nested[key]=value
or
/?nested.key=value
Steps to Reproduce (for bugs)
- Open the page with the pattern above
- Print the this.props.url.query in top level page component
- Does not work
Context
I can’t pass nested object over arbitrarily if I am not using <Link />
component, actually I’m not sure if <Link />
would work with nested object since it is using npm ‘url’ which does not supported nested object parsing…
Btw, I’m currently using https://github.com/ljharb/qs for parsing atm, I hope this saves you all time if you are looking for alternatives.
Your Environment
Tech | Version |
---|---|
next | 2.4.6 |
node | 8.1.3 |
OS | macOS Sierra |
browser | chrome |
etc |
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
reactjs - I am trying to pass date object and other nested ...
The searchOptions that I passed has all it's properties filled while pushing. But the query only has destination property filled, and other date ......
Read more >Dynamic Routes - Next.js
Dynamic Routes are pages that allow you to add custom params to your URLs. ... For example, the route /post/abc will have the...
Read more >NextJS / React SSR: 21 Universal Data Fetching Patterns ...
This is static information that is defined in the query metadata. If the user object is null, meaning that the user is not...
Read more >Pipes | NestJS - A progressive Node.js framework
Nest interposes a pipe just before a method is invoked, and the pipe receives ... These pipes all work in the context of...
Read more >Retrieving Data | Firebase Realtime Database - Google
The REST API accepts several query parameters when reading data from our Firebase ... Firebase also supports queries ordered by deeply nested children, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes. This is something we should work on. Will do this after 3.0.
Feel free to send us a PR.
@chrismatheson as @timneutkens mentioned size of the
qs
is the problem here. We are open to use a smaller well maintained alternative (if exists)