Skip to content
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

fix(serializer): Allow serializers to operate on derived UrlSearchParams classes #647

Merged
merged 4 commits into from
Sep 25, 2024

Conversation

neefrehman
Copy link
Contributor

Follow-up to #646, that allows us to use the response from Next's useSearchParams, for example, as the base argument to a serializer. To do this we create a copy of UrlSearchParams in this code branch.

Copy link

vercel bot commented Sep 25, 2024

@neefrehman is attempting to deploy a commit to the 47ng Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Member

@franky47 franky47 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Could you please add a test to verify that the base parameter is no longer mutated?

packages/nuqs/src/serializer.ts Outdated Show resolved Hide resolved
Copy link

vercel bot commented Sep 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nuqs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 25, 2024 1:52pm

@neefrehman
Copy link
Contributor Author

@franky47 thanks for the review! I've just implemented the change and test

Copy link
Member

@franky47 franky47 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: LGTM, thanks!

@franky47
Copy link
Member

Sorry for the close/reopen, my CI workflow wasn't picking subsequent commits from external contributors (should be fixed in #649).

@franky47 franky47 merged commit 60e0879 into 47ng:master Sep 25, 2024
2 of 3 checks passed
franky47 added a commit that referenced this pull request Sep 25, 2024
#647)

* Create a copy of `UrlSearchParams` when used as the base for a serializer

Follow-up to #646

* Update packages/nuqs/src/serializer.ts

Co-authored-by: François Best <[email protected]>

* test: Add test to show that existing params are not mutated

* chore: Fix formatting

---------

Co-authored-by: François Best <[email protected]>
@franky47 franky47 mentioned this pull request Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants