Skip to content

fix: Handle JSON in TanStack Router#1073

Merged
franky47 merged 3 commits intonextfrom
fix/tsr-json
Aug 18, 2025
Merged

fix: Handle JSON in TanStack Router#1073
franky47 merged 3 commits intonextfrom
fix/tsr-json

Conversation

@franky47
Copy link
Member

@franky47 franky47 commented Aug 18, 2025

TanStack Router parses anything non-string or number with JSON.parse, and provides it "hydrated" in its useLocation hook.

nuqs' parseAsJson expects a JSON string rather than a hydrated object, so we re-serialize it when building the URLSearchParams adapter interface.

Not ideal for performance, but then you should probably use stock TSR APIs for URL state, nuqs compat is mostly for convenience.

References:

Not enabled in TSR yet (need to enable shared tests first)
@franky47 franky47 added the adapters/tanstack-router Uses the TanStack Router adapter label Aug 18, 2025
@franky47 franky47 added this to the 🪵 Backlog milestone Aug 18, 2025
@vercel
Copy link

vercel bot commented Aug 18, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
nuqs Ready Ready Preview Comment Aug 18, 2025 5:26am

@franky47 franky47 changed the title fix: Handle JSON in TSR fix: Handle JSON in TanStack Router Aug 18, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Aug 18, 2025

pnpm add https://pkg.pr.new/nuqs@1073

commit: 9ddcf9c

@franky47 franky47 enabled auto-merge (squash) August 18, 2025 05:23
@franky47 franky47 merged commit 5e24a95 into next Aug 18, 2025
26 checks passed
@franky47 franky47 deleted the fix/tsr-json branch August 18, 2025 05:30
@github-actions
Copy link

🎉 This PR is included in version 2.5.0-beta.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link

🎉 This PR is included in version 2.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@franky47 franky47 removed this from the 🚀 Shipping next milestone Aug 22, 2025
@franky47 franky47 mentioned this pull request Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant