Next.js: NextJS doesn't support parsing nested objects in query parameters

Created on 11 Jul 2017  路  5Comments  路  Source: vercel/next.js

  • [X] 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)


  1. Open the page with the pattern above
  2. Print the this.props.url.query in top level page component
  3. Does not work
    4.

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 | |

Most helpful comment

Yes. This is something we should work on.
Will do this after 3.0.

Feel free to send us a PR.

All 5 comments

Yes. This is something we should work on.
Will do this after 3.0.

Feel free to send us a PR.

I think @chrismatheson has a PR, what do you all think?

im a little confused, @arunoda 's comments seem to imply that the feature is something that is desirable, but the issue has been closed?

Would an implementation that uses something more lightweight than the qs lib be and adequate solution?

@chrismatheson as @timneutkens mentioned size of the qs is the problem here.
We are open to use a smaller well maintained alternative (if exists)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

olifante picture olifante  路  3Comments

swrdfish picture swrdfish  路  3Comments

YarivGilad picture YarivGilad  路  3Comments

kenji4569 picture kenji4569  路  3Comments

ghost picture ghost  路  3Comments