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
We are keen to move to using Nuqs but at the moment it looks like it does not fully support the qs query string format. As far as I can tell, it is not possible to use this format for both nested dynamic objects and arrays within Nuqs.
The closest workaround, provided you know the properties ahead of time, seems to be to use useQueryStates (as discussed here). In an ideal world, it would be possible to create a parser that was able to serialise and parse from a single value to multiple query parameters.
This would make it possible to modify the query parameters before they are persisted to the URL, allowing them, for instance, to be passed through qs to achieve the desired format. Additionally, you would need the same sort of option for parsing it back again.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
We are keen to move to using Nuqs but at the moment it looks like it does not fully support the qs query string format. As far as I can tell, it is not possible to use this format for both nested dynamic objects and arrays within Nuqs.
The closest workaround, provided you know the properties ahead of time, seems to be to use
useQueryStates
(as discussed here). In an ideal world, it would be possible to create a parser that was able to serialise and parse from a single value to multiple query parameters.For example:
which would result in
and something similar too for nested objects.
I appreciate that it may not be straightforward to extend the
createParser
options or logic to support this.With that in mind, would it be worth considering an enhancement to the Adapter logic to allow overriding the following implementation?
https://github.com/47ng/nuqs/blob/next/packages/nuqs/src/lib/url-encoding.ts#L3
This would make it possible to modify the query parameters before they are persisted to the URL, allowing them, for instance, to be passed through qs to achieve the desired format. Additionally, you would need the same sort of option for parsing it back again.
Beta Was this translation helpful? Give feedback.
All reactions