fix: render root tag attributes without a document element on react 19 - #3
Merged
Merged
Conversation
|
|
|
🎉 This PR is included in version 2.1.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Goal
MetaServer.injectemits<html lang="en"><head></head>before the populated head when the host application runs React 19: React 19 renders a full document for a roothtmlelement, and the opening-tag extraction relied on React 18 output. Observed on https://vite-template.lomray.com/ (React 19.2.8).Changes
src/server/index.ts: serialize the merged root props on adivwithrenderToStaticMarkup, rename the opening tag tohtmlorbody, drop the closing tag. Output for the same props is identical to what React 18 produced before.__tests__/server/index.tsx: regression cases for a single head, merged input and manager attributes onhtmlandbody, metadata placement, escaping, style objects and boolean attributes..github/workflows/pr-check.yml: run the tests on the lockfile stack (React 18) and again after swapping inreact@19.2.8andreact-dom@19.2.8.No public API change, no dependency change.
Verification
npm ci --ignore-scripts,npm run lint:check,npm run ts:check: clean.npm teston React 18.2.0: 8 tests pass. Afternpm install --no-save --ignore-scripts react@19.2.8 react-dom@19.2.8: 8 tests pass.npm run buildon Node 20.18.3 (the repository's Node 20 line; the current Rollup plugin stack does not load on Node 22), packedlib, installed the archive into a copy of vite-templateprod(React 19.2.8),ssr-boost build+ssr-boost start:/and/detailseach contain exactly one<head>and start with<html lang="en">\n <head><meta charSet="UTF-8"/>....npm install react@19.2.8 react-dom@19.2.8 @lomray/react-head-manager@2.1.1resolves without peer errors.Not run