mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #794] [CLOSED] fix(app-router): move metadata heads outside loading Suspense boundary #851
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#851
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/794
Author: @NathanDrake2406
Created: 4/8/2026
Status: ❌ Closed
Base:
main← Head:fix/loading-suspense-wraps-metadata📝 Commits (1)
4a015a8fix(app-router): move metadata heads outside loading Suspense boundary📊 Changes
2 files changed (+120 additions, -6 deletions)
View changed files
📝
packages/vinext/src/server/app-page-route-wiring.tsx(+6 -6)📝
tests/app-page-route-wiring.test.ts(+114 -0)📄 Description
Summary
loading.tsxand metadata (export const metadataorgenerateMetadata), the<meta charSet>,<MetadataHead>, and<ViewportHead>elements were assembled before the Suspense wrap inbuildAppPageRouteElement, causing them to land inside the Suspense boundary. For a suspending page, this delayed<title>and Open Graph tags until the page resolved, breaking SEO and social previews.buildAppPageRouteElement— apply the Suspense wrap to the page element first, then assemble the outer metadata fragment around the result. Metadata is now always in the initial HTML shell regardless of whether the page suspends.tests/app-page-route-wiring.test.tsthat walks the React element tree directly to verify that<meta>,MetadataHead, andViewportHeadare siblings ofSuspense, not descendants of it.Test plan
vp test run tests/app-page-route-wiring.test.ts— all 11 tests pass, including the new regression testvp check tests/app-page-route-wiring.test.ts packages/vinext/src/server/app-page-route-wiring.tsx— format, lint, and types cleanslowroute test (renders loading.tsx Suspense wrapper for routes with loading.tsx) still passesrenders dynamic metadata,renders static metadata) still pass🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.