Skip to content

fix: object-form query array serialization in next/link and next/router#457

Open
JaredStowell wants to merge 2 commits intocloudflare:mainfrom
JaredStowell:jstowell/fix-query-array-url-serialization
Open

fix: object-form query array serialization in next/link and next/router#457
JaredStowell wants to merge 2 commits intocloudflare:mainfrom
JaredStowell:jstowell/fix-query-array-url-serialization

Conversation

@JaredStowell
Copy link
Contributor

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 11, 2026

Open in StackBlitz

npm i https://pkg.pr.new/vinext@457

commit: e9bead4

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4330d00bd8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

1 participant