Skip to content

Fix text and attributes escaped twice by experimentalReactChildren - #18786

Merged
Princesseuh merged 1 commit into
withastro:mainfrom
prkomb:fix-react-children-entities
Nov 19, 2026
Merged

Princesseuh merged 1 commit into
withastro:mainfrom
prkomb:fix-react-children-entities

Conversation

@prkomb

@prkomb prkomb commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Fixes #18785

Changes

  • With experimentalReactChildren, text and attribute values in children are no longer escaped twice on the server (Don't rendered as Don't), so islands also stop hitting a hydration mismatch.
  • vnode-children.ts decodes ultrahtml's text with decodeHTML and attribute values with decodeHTMLAttribute from entities (a new dependency, used only by this server-side module), leaving <script> and <style> text as written, as browsers do.

Testing

  • parsed-react-children.test.ts: text and attribute values are decoded (&#39;, &amp;, &nbsp;, &copy;), and <script> and <style> text keeps its references.
  • react-component.test.ts: a new children.astro case passes an expression with ' and & as text and as an attribute, and checks the built HTML has the decoded text and title.

Docs

No docs change needed: the option behaves as before, except that children are no longer escaped twice.

@changeset-bot

changeset-bot Bot commented Nov 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b6c602c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/react-renderer Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added pkg: react Related to React (scope) pkg: integration Related to any renderer integration (scope) labels Nov 19, 2026
@Princesseuh
Princesseuh merged commit f70283d into withastro:main Nov 19, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: integration Related to any renderer integration (scope) pkg: react Related to React (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

experimentalReactChildren escapes text and attribute values twice

2 participants