Allow serialize
functions to operate on ReadOnlyUrlSearchParams
from useSearchParams
#646
Unanswered
neefrehman
asked this question in
Ideas
Replies: 1 comment 1 reply
-
That's a good idea! Regarding the "tight integration with Next.js", as an FYI this is kind of going away with the upcoming Adapters feature in #644. That being said, it looks like the error could be solved by working on a copy of the nuqs/packages/nuqs/src/serializer.ts Lines 73 to 75 in 1049f96 Would you like to open a PR? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We often have a need to create href's to update search params, without affecting any other current params on the page. For example, one link might open a modal, but we want to preserve the underlying pagination state of a table.
To do this, it feels most ergonomic to pass in the response from
useSearchParams
as thebase
parameter:But, this doesn't work and gives the following Next.js error:
Method unavailable on ReadonlyURLSearchParams
. To get around it we do the following:But this feels like a bit too much boilerplate for a library that is deeply integrated with Next, so I wonder if it should be something that the serializer's implementation could be responsible for?
Beta Was this translation helpful? Give feedback.
All reactions