[PR #486] [CLOSED] fix: rewritten pathnames and metadata title resolution #608

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

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/486
Author: @JaredStowell
Created: 3/12/2026
Status: Closed

Base: mainHead: jstowell/fix-pathname-rewrites-and-metadata-titles


📝 Commits (8)

  • 01d8042 Update navigation pathname handling
  • 4867f38 jstowell/fix-nextjs-metadata-and-rewrite-parity
  • c1898db Fix PR 486 parity issues
  • 5d5b8c7 Fix ISR cache pathname keys
  • af4491c Fix ISR cache keys for rewritten App
  • 0dab165 fix test
  • ad9cab2 Fix PR 486 feedback
  • baa03d0 Fix PR 486 feedback

📊 Changes

25 files changed (+838 additions, -282 deletions)

View changed files

📝 packages/vinext/src/entries/app-rsc-entry.ts (+49 -36)
📝 packages/vinext/src/shims/metadata.tsx (+75 -37)
📝 tests/__snapshots__/entry-templates.test.ts.snap (+269 -196)
📝 tests/app-router.test.ts (+93 -1)
📝 tests/features.test.ts (+58 -3)
tests/fixtures/app-basic/app/nextjs-compat/api/(grouped)/endpoint/nested/route.ts (+3 -0)
tests/fixtures/app-basic/app/nextjs-compat/api/cookies-has/route.ts (+10 -0)
tests/fixtures/app-basic/app/nextjs-compat/api/permanent-redirect/route.ts (+5 -0)
tests/fixtures/app-basic/app/nextjs-compat/isr-rewrite-target/page.tsx (+12 -0)
tests/fixtures/app-basic/app/nextjs-compat/isr-rewrite-target/pathname-client.tsx (+9 -0)
📝 tests/fixtures/app-basic/app/nextjs-compat/metadata-parent-generate/layout.tsx (+4 -0)
📝 tests/fixtures/app-basic/app/nextjs-compat/metadata-parent-generate/page.tsx (+3 -0)
tests/fixtures/app-basic/app/nextjs-compat/metadata-socials/page.tsx (+13 -0)
tests/fixtures/app-basic/app/nextjs-compat/metadata-title-template/extra/inner/deep/page.tsx (+3 -0)
tests/fixtures/app-basic/app/nextjs-compat/metadata-title-template/extra/inner/page.tsx (+9 -0)
tests/fixtures/app-basic/app/nextjs-compat/metadata-title-template/extra/layout.tsx (+12 -0)
tests/fixtures/app-basic/app/nextjs-compat/metadata-title-template/use-layout-title/page.tsx (+3 -0)
tests/fixtures/app-basic/app/not-found/page.tsx (+3 -0)
📝 tests/fixtures/app-basic/middleware.ts (+6 -1)
📝 tests/fixtures/app-basic/next.config.ts (+15 -0)

...and 5 more files

📄 Description

This fixes two App Router parity gaps with Next.js and hardens the related coverage.

  • Preserve the canonical requested pathname in navigation context after rewrites so usePathname() reflects the source URL, not the rewritten destination.
  • Fix metadata title resolution so nested defaults, ancestor templates, and multi-placeholder templates match Next.js behavior.
  • Preserve resolved parent title state for generateMetadata(_, parent), including title.absolute and title.template, instead of collapsing parent titles to a plain string.
  • Add regression coverage for middleware rewrites, parent metadata title shape, title uniqueness, and multi-placeholder templates.
  • Refresh generated App Router entry snapshots for the updated parent metadata merge path.

Testing

  • pnpm test tests/features.test.ts -t "metadata title templates"
  • pnpm test tests/nextjs-compat/hooks.test.ts tests/nextjs-compat/metadata.test.ts tests/entry-templates.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/486 **Author:** [@JaredStowell](https://github.com/JaredStowell) **Created:** 3/12/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `jstowell/fix-pathname-rewrites-and-metadata-titles` --- ### 📝 Commits (8) - [`01d8042`](https://github.com/cloudflare/vinext/commit/01d80426cb8ea010145d1cc36ee5d0d89dbe5a21) Update navigation pathname handling - [`4867f38`](https://github.com/cloudflare/vinext/commit/4867f38717eac98276dc9c1579e2f47567c789d0) jstowell/fix-nextjs-metadata-and-rewrite-parity - [`c1898db`](https://github.com/cloudflare/vinext/commit/c1898db3e9945e48fc0bd740dc2ff2e8dab7fb11) Fix PR 486 parity issues - [`5d5b8c7`](https://github.com/cloudflare/vinext/commit/5d5b8c7593cff41a2407e25e981026f5d75e17f0) Fix ISR cache pathname keys - [`af4491c`](https://github.com/cloudflare/vinext/commit/af4491c36de7832e8e9d8db37d61a62dc790636f) Fix ISR cache keys for rewritten App - [`0dab165`](https://github.com/cloudflare/vinext/commit/0dab165018e2a3bf0e52e5aa5ac9647f88a18bf0) fix test - [`ad9cab2`](https://github.com/cloudflare/vinext/commit/ad9cab22b30f60b04f3a1b4702409288c7341048) Fix PR 486 feedback - [`baa03d0`](https://github.com/cloudflare/vinext/commit/baa03d033d660c88afe826501dcd6e83387450c2) Fix PR 486 feedback ### 📊 Changes **25 files changed** (+838 additions, -282 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/entries/app-rsc-entry.ts` (+49 -36) 📝 `packages/vinext/src/shims/metadata.tsx` (+75 -37) 📝 `tests/__snapshots__/entry-templates.test.ts.snap` (+269 -196) 📝 `tests/app-router.test.ts` (+93 -1) 📝 `tests/features.test.ts` (+58 -3) ➕ `tests/fixtures/app-basic/app/nextjs-compat/api/(grouped)/endpoint/nested/route.ts` (+3 -0) ➕ `tests/fixtures/app-basic/app/nextjs-compat/api/cookies-has/route.ts` (+10 -0) ➕ `tests/fixtures/app-basic/app/nextjs-compat/api/permanent-redirect/route.ts` (+5 -0) ➕ `tests/fixtures/app-basic/app/nextjs-compat/isr-rewrite-target/page.tsx` (+12 -0) ➕ `tests/fixtures/app-basic/app/nextjs-compat/isr-rewrite-target/pathname-client.tsx` (+9 -0) 📝 `tests/fixtures/app-basic/app/nextjs-compat/metadata-parent-generate/layout.tsx` (+4 -0) 📝 `tests/fixtures/app-basic/app/nextjs-compat/metadata-parent-generate/page.tsx` (+3 -0) ➕ `tests/fixtures/app-basic/app/nextjs-compat/metadata-socials/page.tsx` (+13 -0) ➕ `tests/fixtures/app-basic/app/nextjs-compat/metadata-title-template/extra/inner/deep/page.tsx` (+3 -0) ➕ `tests/fixtures/app-basic/app/nextjs-compat/metadata-title-template/extra/inner/page.tsx` (+9 -0) ➕ `tests/fixtures/app-basic/app/nextjs-compat/metadata-title-template/extra/layout.tsx` (+12 -0) ➕ `tests/fixtures/app-basic/app/nextjs-compat/metadata-title-template/use-layout-title/page.tsx` (+3 -0) ➕ `tests/fixtures/app-basic/app/not-found/page.tsx` (+3 -0) 📝 `tests/fixtures/app-basic/middleware.ts` (+6 -1) 📝 `tests/fixtures/app-basic/next.config.ts` (+15 -0) _...and 5 more files_ </details> ### 📄 Description This fixes two App Router parity gaps with Next.js and hardens the related coverage. - Preserve the canonical requested pathname in navigation context after rewrites so `usePathname()` reflects the source URL, not the rewritten destination. - Fix metadata title resolution so nested defaults, ancestor templates, and multi-placeholder templates match Next.js behavior. - Preserve resolved parent title state for `generateMetadata(_, parent)`, including `title.absolute` and `title.template`, instead of collapsing parent titles to a plain string. - Add regression coverage for middleware rewrites, parent metadata title shape, title uniqueness, and multi-placeholder templates. - Refresh generated App Router entry snapshots for the updated parent metadata merge path. ## Testing - `pnpm test tests/features.test.ts -t "metadata title templates"` - `pnpm test tests/nextjs-compat/hooks.test.ts tests/nextjs-compat/metadata.test.ts tests/entry-templates.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:09:02 +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#608
No description provided.