Skip to content

Pages Router: <Link> / router.push() strip query string from href #1471

@james-elicx

Description

@james-elicx

This issue was created by an agent analysing CI failures from the Next.js Deploy Suite (vinext main vs Next.js v16.2.6, 2026-05-22).

Problem

When a Pages Router <Link href="https://github.com/about?hello=world"> is rendered (or router.push('/about?hello=world') is called), vinext drops the ?hello=world from both the rendered href attribute and the resulting navigation URL. Affects ~6 trailing-slashes tests asserting the final URL retains the query.

Expected URL `/about?hello=world`, got `/about`

Estimated Impact

~6 test failures across the deploy suite.

Affected Test Suites

  • test/e2e/trailing-slashes/without-trailing-slash.test.ts (6 failures)

Recommendation

  1. Reproduce first in vinext's own test suite. Render <Link href="https://github.com/about?hello=world"> and click it; assert location.search === '?hello=world'.

  2. Preserve query in the Link href resolver and the router. When normalising href, do not strip the query string. Pass it through to the navigation API and ensure the trailing-slash rewrite step does not drop it.

  3. Re-check after trailing-slash normalisation. This intersects with Trailing slash configuration not enforced #1332 — trailing-slash normalisation must preserve the query.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions