Skip to content

fix(pages-router): rename data-vinext-head to data-next-head#1559

Merged
james-elicx merged 1 commit into
mainfrom
fix/data-next-head-attr
May 22, 2026
Merged

fix(pages-router): rename data-vinext-head to data-next-head#1559
james-elicx merged 1 commit into
mainfrom
fix/data-next-head-attr

Conversation

@james-elicx

@james-elicx james-elicx commented May 22, 2026

Copy link
Copy Markdown
Member

Refs #1475 — attribute rename only. Follow-up issue: #1569.

Summary

  • Pages Router <Head> now emits the canonical data-next-head attribute (empty value) instead of data-vinext-head="true".

Out of scope (tracked in #1569)

  • charset/viewport ordering parity
  • _document.getInitialProps() head-tag merge order

Do not close #1475 when this PR merges — close it when #1569 also lands.

Test plan

  • Tests assert canonical attribute
  • vp check passes

Pages Router <Head> now emits the canonical `data-next-head=""`
attribute matching Next.js, rather than the vinext-specific
`data-vinext-head="true"`. This unblocks `_document` head lookups
in the deploy suite.
@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review

@pkg-pr-new

pkg-pr-new Bot commented May 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: c321336

@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
web preview production

@ask-bonk ask-bonk Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified against Next.js source (packages/next/src/pages/_document.tsx:616, packages/next/src/client/head-manager.ts:57,70) and their E2E tests (test/e2e/next-head/index.test.ts). The attribute name, empty-string value, and selector pattern all match upstream. No remaining data-vinext-head references in the codebase.

One minor observation for a future follow-up (not blocking): Next.js scopes its client-side removal selector by tag type (${type}[data-next-head]), while vinext removes all [data-next-head] elements at once in syncClientHead. This is functionally equivalent since vinext re-appends everything immediately after, but noting it for parity tracking.

LGTM — clean rename, tests updated.

@ask-bonk

ask-bonk Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

Approved PR #1559. The change is correct and matches Next.js behavior:

  • Attribute rename: data-vinext-head="true" -> data-next-head="" — matches Next.js exactly (_document.tsx:616 uses { 'data-next-head': '' }, head-manager.ts:70 uses setAttribute('data-next-head', ''))
  • Value change: "true" -> "" (empty string) — matches Next.js's empty string convention, confirmed by their E2E tests
  • Selector: [data-next-head] attribute-presence selector — functionally correct
  • No stale references: Zero remaining data-vinext-head occurrences in the codebase
  • Tests updated: Both head.test.ts and shims.test.ts assert the new canonical attribute

github run

@james-elicx
james-elicx marked this pull request as ready for review May 22, 2026 14:40
@james-elicx
james-elicx merged commit 97c11cd into main May 22, 2026
36 checks passed
@james-elicx
james-elicx deleted the fix/data-next-head-attr branch May 22, 2026 14:55
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 next/head: emits data-vinext-head and ignores charset/_document.getInitialProps merge order

1 participant