-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query string formatting is odd? #1
Comments
This is by design. The readability and shortness of the generated querystring was important when I implemented this, but I also wanted to avoid breaking existing library/user code. The querystring middleware takes control of the addressbar of your browser and stores nested object structures in it serialized to a custom format. This format is not compatible with other libraries/user code. I wanted to minimize the number of issues/undefined behavior this would cause, for this reason the middleware stores all of the data in one single search parameter(by default But you are right ideally the query string would look like your example. I will experiment with this and try to add a |
Yeah that makes sense. I 100% approve of the idea to make it compatible with other libraries, but having the option to turn that off and use a cleaner format would be nice. Thanks! |
Seconded, I too would like to see openapi formatted parameters so nextjs can work with them in server mode. Right now I get them in this format :(
next search params response:
|
+1 for the |
The parameters should be accessible from the store, on server-side. You can use the |
Yep that worked on the server-side Using the following
Created a PR to show this as part of the examples |
Released https://github.com/nitedani/zustand-querystring/releases/tag/v0.1.0 |
@nitedani Is there a way to use the old readable style in the latest version? |
My app has a very simple usage of this library where it stores the "search" query from a search box.
The store is set up like this:
It works, but the formatting of the query string in the address bar looks very odd. The resulting url is:
http://localhost:3000/shop?$=query=some%20search%20query;;
I believe the proper formatting would be:
http://localhost:3000/shop?query=some%20search%20query
Is this an error in the library or something that is configurable? Thanks in advance.
The text was updated successfully, but these errors were encountered: