Skip to content

Project document head elements#10

Draft
southpolesteve wants to merge 1 commit intoTanStack:mainfrom
southpolesteve:codex/redact-document-head-projection
Draft

Project document head elements#10
southpolesteve wants to merge 1 commit intoTanStack:mainfrom
southpolesteve:codex/redact-document-head-projection

Conversation

@southpolesteve
Copy link
Copy Markdown
Collaborator

Summary

  • Ensure SSR emits an empty <head> when rendering an <html> tree with no head child.
  • Hoist top-level React 19-style head tags into <head> when hydrating a Document root.
  • Adopt document-level head tags from document.head during hydration and insert new document-level head tags into document.head.
  • Add document hydration coverage for omitted <head> and top-level metadata.

Why

vinext follows Next/App Router document semantics where metadata can be represented as top-level head elements around the html shell. Browsers only allow one document element and head-managed tags must live in document.head. Without this, Redact can try to append <meta> directly to document during hydration, causing Only one element on document allowed, or fail to match server-rendered metadata.

This makes Redact compatible with vinext App Router SSR/hydration while keeping existing <head>/<html> adoption position-insensitive.

Validation

  • pnpm --filter tests test -- document-hydration

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.

1 participant