Repository navigation
fix(octane): preserve unchanged trusted HTML child identity - #1278
Merged
domgan-oai merged 1 commit intoSep 23, 2026
Merged
Conversation
domgan-oai
marked this pull request as ready for review
September 23, 2026 09:22
6 of 9 tasks
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.
Summary
A fresh
trustHTML()wrapper with unchanged content currently replaces the host's children on the first render after hydration and on client updates. Cache the accepted HTML string in the owning runtime setter so these renders preserve child identity. Matching hydration seeds the cache; writes and ownership release journal it for rollback. Script text updates retain their existing behavior.Fixes #1259.
Validation
pnpm syncand scoped formatting completed; generated files are unchanged.octaneandoctane-prod. Covers trusted HTML, raw-HTML validation and source precedence, ownership transitions, script content, hydration mismatches, Suspense preservation, and ViewTransition host state.pnpm format:check(repository-wide; scoped formatting used)pnpm typecheck(repository-wide; scoped checks used)pnpm test(repository-wide; affected suites used)The regression uses the real fixture compiler and SSR/hydration path and asserts child identity. A browser pointer gesture was not separately exercised.
Provenance
agent-authored)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Touches core
dangerouslySetInnerHTMLhydration and client update paths with new host state and journaling; behavior is well covered by tests but affects DOM mutation semantics.Overview
Fixes child identity for unchanged
trustHTML()/dangerouslySetInnerHTMLcontent after hydration and on client re-renders, where a fresh wrapper used to replace DOM nodes even when the HTML string was the same.The runtime now caches the accepted authored HTML on the host (
DANGER_HTML_VALUE), seeded when hydration adopts matching markup and updated on real writes. Identical subsequent values skipinnerHTMLreplacement (scripts keep existing text behavior). Cache updates are journaled for staged/rollback renders, and cleared when raw HTML ownership is released so ordinary children can take over.Tests cover stable nodes across hydrate/update cycles, parser-normalized markup, hydration mismatches (with/without suppression), toggling between raw HTML and ordinary children, and retained markup when a suspended render is abandoned.
Reviewed by Cursor Bugbot for commit 79c03a0. Bugbot is set up for automated code reviews on this repo. Configure here.