mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #518] [MERGED] Fix next/head key deduplication #640
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#640
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/518
Author: @NathanDrake2406
Created: 3/13/2026
Status: ✅ Merged
Merged: 3/13/2026
Merged by: @james-elicx
Base:
main← Head:fix/next-head-key-dedup📝 Commits (4)
7628bb9Fix next/head key deduplicationc1dc8daFix multi-child next/head deduplicationd824574Align next/head key normalization with Next.jsb04be19Merge upstream/main into fix/next-head-key-dedup📊 Changes
6 files changed (+310 additions, -69 deletions)
View changed files
📝
packages/vinext/src/shims/head-state.ts(+8 -7)📝
packages/vinext/src/shims/head.ts(+178 -51)📝
packages/vinext/src/shims/unified-request-context.ts(+2 -2)📝
tests/fixtures/pages-basic/pages/isr-second-render-state.tsx(+1 -1)📝
tests/head.test.ts(+113 -0)📝
tests/unified-request-context.test.ts(+8 -8)📄 Description
Summary
next/headchildren through a shared reducer for both SSR and client updatesReact.Children.toArray()$are not collapsedWhy
The previous shim appended tags per
Headinstance, so keyed deduplication could not match Next.js behavior. The first pass at fixing that also introduced an array-flattening regression by bypassing React key scoping and a key-normalization collision for raw keys containing$.Testing
pnpm test tests/head.test.tspnpm test tests/pages-router.test.ts -t "renders next/head tags in SSR HTML <head>"pnpm run typechecktests/head.test.ts, lint, and typecheck successfully🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.