[PR #457] [MERGED] fix: object-form query array serialization in next/link and next/router #585

Closed
opened 2026-05-06 13:08:54 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/457
Author: @JaredStowell
Created: 3/11/2026
Status: Merged
Merged: 3/11/2026
Merged by: @james-elicx

Base: mainHead: jstowell/fix-query-array-url-serialization


📝 Commits (2)

  • 4330d00 Fix query param handling
  • bde4c63 Fix scalar query serialization

📊 Changes

7 files changed (+195 additions, -8 deletions)

View changed files

📝 packages/vinext/src/shims/link.tsx (+3 -3)
📝 packages/vinext/src/shims/router.ts (+8 -3)
📝 packages/vinext/src/utils/query.ts (+38 -0)
📝 tests/fixtures/app-basic/next-shims.d.ts (+3 -1)
📝 tests/fixtures/pages-basic/next-shims.d.ts (+3 -1)
📝 tests/link.test.ts (+29 -0)
📝 tests/shims.test.ts (+111 -0)

📄 Description

Fix object-form URL serialization so array query values are emitted as repeated params instead of comma-joined strings.

Before:

  • { pathname: "/search", query: { tag: ["a", "b"], q: "x" } }
  • serialized to /search?tag=a,b&q=x

After:

  • serializes to /search?tag=a&tag=b&q=x

Changes

  • add a shared query serializer that matches Next.js behavior for array values
  • use that serializer in both next/link and next/router
  • widen fixture next/link typings to allow array query values
  • add regressions for Link rendering and router navigation

Testing

  • pnpm test tests/link.test.ts
  • pnpm test tests/shims.test.ts
  • pnpm run fmt
  • pnpm run typecheck

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/457 **Author:** [@JaredStowell](https://github.com/JaredStowell) **Created:** 3/11/2026 **Status:** ✅ Merged **Merged:** 3/11/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `jstowell/fix-query-array-url-serialization` --- ### 📝 Commits (2) - [`4330d00`](https://github.com/cloudflare/vinext/commit/4330d00bd86125fcd08c7428bcdf8da0a6f67473) Fix query param handling - [`bde4c63`](https://github.com/cloudflare/vinext/commit/bde4c634473b7d132f956d0b58e5574eb08a7301) Fix scalar query serialization ### 📊 Changes **7 files changed** (+195 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/shims/link.tsx` (+3 -3) 📝 `packages/vinext/src/shims/router.ts` (+8 -3) 📝 `packages/vinext/src/utils/query.ts` (+38 -0) 📝 `tests/fixtures/app-basic/next-shims.d.ts` (+3 -1) 📝 `tests/fixtures/pages-basic/next-shims.d.ts` (+3 -1) 📝 `tests/link.test.ts` (+29 -0) 📝 `tests/shims.test.ts` (+111 -0) </details> ### 📄 Description Fix object-form URL serialization so array query values are emitted as repeated params instead of comma-joined strings. Before: - `{ pathname: "/search", query: { tag: ["a", "b"], q: "x" } }` - serialized to `/search?tag=a,b&q=x` After: - serializes to `/search?tag=a&tag=b&q=x` ## Changes - add a shared query serializer that matches Next.js behavior for array values - use that serializer in both `next/link` and `next/router` - widen fixture `next/link` typings to allow array query values - add regressions for Link rendering and router navigation ## Testing - `pnpm test tests/link.test.ts` - `pnpm test tests/shims.test.ts` - `pnpm run fmt` - `pnpm run typecheck` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:08:54 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#585
No description provided.