Closed lecbyjak closed 3 months ago
Thanks for the report. It looks like the key should be encoded in the same way as the value here: https://github.com/47ng/nuqs/blob/next/packages%2Fnuqs%2Fsrc%2Furl-encoding.ts#L7
I'll run some tests and come back to you.
I have published a fix in #600 via a snapshot release, could you give it a try and let me know if it solves your problem?
npm install nuqs@1.17.8-snapshot.2024-08-07.fb4c41b3
Awsome. Works!
Thanks for super quick response 💚
:tada: This issue has been resolved in version 1.17.8 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Context
What's your version of
nuqs
?Next.js information (obtained by running
next info
):Are you using:
basePath
option in your Next.js configwindowHistorySupport
flag in your Next.js configDescription
Having a special character (&) in key, causes url read issues.
Reproduction
When using following keyMap the keys in the URL are not encoded resulting in incorrect read/sync
When using following keyMap with encoded keys, the URL is correctly encoded, but after sync operation 'useQueryStates' returns traits as
{ 'Duration%20%26%20Location': null }
. Using a debugger I saw that the query state object was{ 'Duration+%26+Location': null }
I have also tried to use following keyMap but with the same result