Skip to content

fix(pages-router): format object as navigation urls - #3354

Open
james-elicx wants to merge 13 commits into
mainfrom
codex/fix-pages-object-as
Open

james-elicx wants to merge 13 commits into
mainfrom
codex/fix-pages-object-as

Conversation

@james-elicx

@james-elicx james-elicx commented Sep 21, 2026

Copy link
Copy Markdown
Member

Closes #3351\n\n## Summary\n\n- accept URL objects for the Pages Router push and replace as argument\n- match Next.js URL-object formatting, WHATWG canonicalization, dynamic/query-only resolution, and same-origin/basePath handling\n- preserve empty query/hash delimiters, tracked asPath semantics, locale-domain masks, and internal double-slash middleware paths\n- preserve dangerous-scheme and external-navigation safety while matching href/as ordering and return values\n- emit the Next.js repeated-slash diagnostic once per invalid string or object argument\n- tolerate runtime null masks like Next.js\n- cover hook push, singleton replace, query/search/hash, history behavior, unsafe schemes, locale/basePath, relative/protocol/authority forms, same-origin boundaries, and external href/as combinations\n\n## Root cause\n\nThe first URL argument was formatted, but object-form as values reached string-only URL handling unchanged. The public declarations also restricted as to strings. Matching prepareUrlAs required formatting the full UrlObject surface, resolving every local object through WHATWG URL semantics against router state, keeping explicit as behavior distinct from href interpolation, and preserving basePath, delimiter, middleware, locale-domain, and external-navigation invariants.\n\nNext.js references:\n- https://github.com/vercel/next.js/blob/canary/packages/next/src/shared/lib/router/router.ts\n- https://github.com/vercel/next.js/blob/canary/packages/next/src/shared/lib/router/utils/format-url.ts\n- https://github.com/vercel/next.js/blob/canary/packages/next/src/client/resolve-href.ts\n\n## Validation\n\n- vp test run tests/shims.test.ts tests/router-javascript-urls.test.ts (1,426 passed)\n- targeted Pages Router browser regressions (2 passed on isolated port 4273)\n- vp check\n- vp run vinext#build\n- node scripts/sync-next-types.mjs --check\n- node scripts/check-shim-types.mjs\n- simplification review: 22 runtime lines and 172 net test-scaffolding lines removed with parity cases preserved

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

@pkg-pr-new

pkg-pr-new Bot commented Sep 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vinext/cloudflare

npm i https://pkg.pr.new/@vinext/cloudflare@3354

create-vinext-app

npm i https://pkg.pr.new/create-vinext-app@3354

@vinext/types

npm i https://pkg.pr.new/@vinext/types@3354

vinext

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

@cloudflare/workers-response-store

npm i https://pkg.pr.new/@cloudflare/workers-response-store@3354

commit: 6e5d25e

@github-actions

Copy link
Copy Markdown
Contributor
Example Preview Production Original
app-router-cloudflare preview production
pages-router-cloudflare preview production
app-router-playground preview production original
realworld-api-rest preview production
nextra-docs-template preview production
benchmarks preview production
hackernews preview production original
response-store-demo preview production
workers-cache preview production
kv preview production
static-export preview production
web preview production

@github-actions

github-actions Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Performance benchmarks

Compared 6e5d25e against base d4b3991 using alternating same-runner rounds. Next.js was unchanged and skipped.

0 improved · 0 regressed · 6 within ±1.5%

Scenario Framework Baseline Current Change
Client bundle size (gzip) vinext 142.3 KB 142.3 KB ⚫ -0.0%
Client entry size (gzip) vinext 129.7 KB 129.7 KB ⚫ -0.0%
Dev server cold start vinext 3.17 s 3.17 s ⚫ -0.3%
Production build time vinext 3.44 s 3.42 s ⚫ -0.6%
RSC entry closure size (gzip) vinext 127.6 KB 127.5 KB ⚫ -0.0%
Server bundle size (gzip) vinext 225.7 KB 225.7 KB ⚫ -0.0%

View detailed results and traces

🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head

Comment thread packages/vinext/src/shims/router.ts Outdated
@ask-bonk

ask-bonk Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Posted 1 actionable inline finding. Targeted unit tests passed.

github run

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Comment thread packages/vinext/src/shims/router.ts Fixed
Comment thread packages/vinext/src/shims/router.ts Fixed
@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

@ask-bonk

ask-bonk Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

@james-elicx Bonk workflow was cancelled.

View workflow run · To retry, trigger Bonk again.

Comment thread packages/vinext/src/shims/router.ts Outdated
@ask-bonk

ask-bonk Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Posted 1 actionable inline finding. Targeted unit tests passed.

github run

@james-elicx

Copy link
Copy Markdown
Member Author

Time limit: 8 minutes. Complete the review and post all findings within that limit.

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Comment thread packages/vinext/src/shims/router.ts Outdated
@ask-bonk

ask-bonk Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Posted 1 actionable inline finding.

github run

@james-elicx

Copy link
Copy Markdown
Member Author

Time limit: 8 minutes. Complete the review and post all findings within that limit.

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Comment thread packages/vinext/src/shims/router.ts Outdated
Comment thread packages/vinext/src/shims/router.ts Outdated
@ask-bonk

ask-bonk Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Posted 2 actionable inline findings.

github run

@james-elicx

Copy link
Copy Markdown
Member Author

Time limit: 8 minutes. Complete the review and post all findings within that limit.

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Comment thread packages/vinext/src/shims/router.ts Outdated
@ask-bonk

ask-bonk Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Posted 1 actionable inline finding. Targeted URL-object tests passed.

github run

@james-elicx

Copy link
Copy Markdown
Member Author

Time limit: 8 minutes. Complete the review and post all findings within that limit.

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Comment thread packages/vinext/src/shims/router.ts Outdated
Comment thread packages/vinext/src/shims/router.ts
Comment thread packages/vinext/src/shims/router.ts
@ask-bonk

ask-bonk Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Posted 3 actionable inline findings.

github run

@james-elicx

Copy link
Copy Markdown
Member Author

Time limit: 8 minutes. Complete the review and post all findings within that limit.

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Comment thread packages/vinext/src/shims/router.ts
Comment thread packages/vinext/src/shims/router.ts
Comment thread packages/vinext/src/shims/router.ts
Comment thread packages/vinext/src/shims/router.ts
Comment thread tests/shims.test.ts Outdated
@ask-bonk

ask-bonk Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Posted 5 actionable inline findings.

github run

@james-elicx

Copy link
Copy Markdown
Member Author

Time limit: 8 minutes. Complete the review and post all findings within that limit.

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Comment thread packages/vinext/src/shims/router.ts Outdated
@ask-bonk

ask-bonk Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Posted 1 actionable inline finding. No repository changes made.

github run

@james-elicx

Copy link
Copy Markdown
Member Author

Time limit: 8 minutes. Complete the review and post all findings within that limit.

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

@ask-bonk

ask-bonk Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

LGTM!

github run

@james-elicx

Copy link
Copy Markdown
Member Author

Time limit: 8 minutes. Complete the review and post all findings within that limit.

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

@ask-bonk

ask-bonk Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

LGTM!

github run

@james-elicx
james-elicx marked this pull request as ready for review September 22, 2026 01:16
@james-elicx
james-elicx marked this pull request as draft September 22, 2026 01:23
@james-elicx

Copy link
Copy Markdown
Member Author

Time limit: 8 minutes. Complete the review and post all findings within that limit.

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

@ask-bonk

ask-bonk Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

LGTM!

github run

@james-elicx
james-elicx marked this pull request as ready for review September 22, 2026 01:31
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.

Pages Router: object-form as in push/replace reaches string-only URL handling and throws

2 participants