Skip to content

Fix array query params in client-side navigation#94956

Open
AshokGaire3 wants to merge 2 commits into
vercel:canaryfrom
AshokGaire3:codex/fix-array-query-params
Open

Fix array query params in client-side navigation#94956
AshokGaire3 wants to merge 2 commits into
vercel:canaryfrom
AshokGaire3:codex/fix-array-query-params

Conversation

@AshokGaire3

Copy link
Copy Markdown

What?

Replaced Object.fromEntries(new URLSearchParams(renderedSearch)) with urlSearchParamsToParsedUrlQuery when computing segment cache keys in the client-side router.

Why?

When submitting a form with multiple checkboxes that share the same name attribute, the URL reflects arrays in query parameters (e.g., ?type=test1&type=test2). During a client navigation, Object.fromEntries was incorrectly omitting all but the last parameter (resulting in {"type":"test2"}), causing the client router segment matching to falsely hit the local cache and show stale UI state.

How?

Using the urlSearchParamsToParsedUrlQuery utility correctly parses identical duplicate search parameter keys into arrays, which constructs a correct segment key, leading to a successful dynamic route prefetch on change.

Verification

  • Confirmed fix with the issue reproduction script using a Playwright next start test.
  • The GET request to /?type=test2&_rsc=... is correctly spawned upon navigating away from /?type=test1&type=test2.

@AshokGaire3 AshokGaire3 marked this pull request as ready for review June 18, 2026 20:47
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