Repository navigation
fix(octane): serialize a spread host's sole child unframed and keep textarea children live - #1432
Merged
Merged
Conversation
…extarea children live
The client mounts a host's only renderable `{expr}` child markerless whether
or not the host has a spread. The server's only-child branch was additionally
gated on having no dangerouslySetInnerHTML source, and every spread adds one,
so spread hosts fell back to a framed `<!--[-->…<!--]-->` child. Inside a
<textarea> (RCDATA) that frame parsed as literal default-value text and
hydration reported a text mismatch. It also hid an option's label from the
server select projection, so `<option {...rest}>{label}</option>` was never
server-selected.
On the client, `applyFormControlValues` reset a textarea's defaultValue to ''
on every update without value/defaultValue (React's updateTextarea). Authored
Octane textarea children are a live text binding, so that reset detached the
child's Text node and every update emptied a spread textarea. Skip the reset
when the host has nested children.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
trueadm
marked this pull request as ready for review
September 29, 2026 21:59
This was referenced Sep 29, 2026
trueadm
added a commit
that referenced
this pull request
Sep 29, 2026
…ides (#1435) * fix(octane): render a textarea's children as one text value on both sides Textarea content is RCDATA: the HTML parser keeps markup and comments inside it as literal text. A textarea with more than one child compiled to a client template with `<!>` placeholders inside the textarea (a client-only mount threw reading `parentNode` of null) and a server frame such as `hello <!-- -->A`, so the pre-hydration value held the markers and hydration reported a mismatch or rebuilt the root. A textarea's children now fold into one text value. The compiler binds it as the host's only Text node through `textareaText` and the server serializes it markerless through `ssrTextareaText`. Descriptor textareas (createElement, stored JSX) and a children prop from a spread follow the same rule. Strings and numbers render, empty values render nothing, arrays and iterables join, and any other value throws error 336 on both sides. Markup or a template directive written inside a textarea is a compile error. Signal handles in a compiled textarea's holes stay live through one derived handle over the parts. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(octane): update mixed children of a spread textarea after hydration The spread textarea default reset is fixed on main (#1432), so the spread cases now join the shared mount, hydrate and update matrix. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(octane): fold a de-opt textarea's children whatever its tag's case HTML tag names are ASCII case-insensitive, and ssrHostElement folds a descriptor textarea's children on the lowercased tag. The client compared the authored type exactly, so `createElement('TEXTAREA', null, 'a', list)` still reconciled its children as a keyed list and left range comments inside the textarea. Both de-opt paths now share a case-insensitive check that compares the string before any DOM read. With main merged, the only-child hole tests from #1430 expected an element value inside a textarea to render beside the server text. A textarea's children are text on both sides now, so that case asserts the error on the server and through onUncaughtError on the client, and the suspending-hole fixture no longer puts an element in a textarea. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
trueadm
added a commit
that referenced
this pull request
Sep 30, 2026
…ross updates (#1438) A textarea's `children` from a spread or a `children=` prop renders through the same live text binding as authored children, but applyFormControlValues only knew about authored JSX children (#1432). Every update without a value/defaultValue writer ran React's updateTextarea reset (`defaultValue = ''`), which detached the binding's Text node, so later updates wrote outside the element and the field emptied. This hit `<textarea {...{ children }} />`, `{...rest} children=`, a direct `children= value= defaultValue=` cascade, and a signal-held sibling prop that re-applies host props on its own, both client-only and after hydration. Skip the reset when a children writer was present at the previous commit, which is when the child binding can still hold DOM. Keying on the incoming props instead would append to a removed defaultValue's text when children take over (`{defaultValue:'Y'} -> {children:'B'}` rendered "YB"); the previous-commit rule matches the createElement path exactly. Co-authored-by: Claude Opus 5.5 <[email protected]>
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
Server rendering
<textarea {...rest}>{value}</textarea>wrote hydration markers inside the textarea. Textarea content is RCDATA, so the parser kept them as text: before hydration the default value was literally<!--[-->A<!--]-->, andhydrateRootwith identical props reported a text mismatch toonRecoverableErrorandconsole.error.Root cause (compiler). The client lowers a host's only renderable
{expr}child markerless (onlyChildText) whether or not the host has a spread. The server's matching branch inssrEmitElementalso requiredhtmlSources.length === 0. Every spread pushes a possibledangerouslySetInnerHTMLsource, so spread hosts fell back tossrEmitNodesand a framedssrChildPre. The client'shtextunwraps such a frame on ordinary hosts, which hid the drift everywhere except RCDATA. Dropping the gate makes the server's condition match the client's again. That also fixes:<option {...rest}>{label}</option>without avalue.ssrOptionSelectedskips its text fallback when content contains<, so a framed label never matched the select'svalue/defaultValue, and the server painted the wrong option until hydration.Second defect found while testing (runtime). Updating the child of a spread textarea emptied it, even client-only: mount
'A', render'Updated', get''.applyFormControlValuesresets a textarea'sdefaultValueto''on every non-first update with novalue/defaultValue, mirroring React'supdateTextarea, where children only seed the initial value. Octane's authored textarea children are a live text binding (docs/differences-from-react.md), so the reset detached the child's Text node. It is now skipped when the host has nested children.setHostPropSourcesalready knows this and threads it through. TheformCommit/setFormControlSourcespath is unreachable for spread hosts, and a childless spread textarea keeps React's reset (the existing conformance test for that still passes).Validation
pnpm format:check(not run repo-wide;pnpm format:files:checkon changed files is clean)pnpm typecheck(not run repo-wide;pnpm typecheck:filesis clean for the source and new test files. The conformance fixture file already has untypedpropsand deliberate duplicate-attribute errors onmain, and this adds none.)pnpm test(not run in full locally because it runs out of memory)packages/octane/testsinoctane+octane-prodbefore rebase: 1,233 files / 25,216 tests passmain:tests/hydration,tests/conformance,tests/compiler,tsrx-block.test.tsin both projects: 463 files / 10,745 tests passoctane-signals*projects: 58 files / 991 tests passtests/hydration/spread-sole-child-hydrate.test.ts(31 cases × dev/prod). It checks that the server-rendered textareadefaultValueis the plain text, that identical-props hydration reports nothing, that the node is reused, and that a later update works; plus the ternary and option cases. With the compiler fix reverted, 22 of 31 fail (e.g.expected '<!--[-->A<!--]-->' to be 'A').client-host-source-aggregation.test.tsfails with the runtime fix reverted (expected '' to be 'second').No timing benchmark was run. The change removes work: 16 marker bytes per affected host on the server, and the client no longer strips them during hydration. Client code is unchanged apart from one boolean argument on the spread form-host update path.
Risk / follow-ups
ssrChildand keep their frame.hello {x as string}), which crash client-only because template placeholders land inside RCDATA.<title {...rest}>{x}</title>also mismatches on hydration. That is unrelated and reproduces onmain.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Changes SSR markup for all spread hosts with a sole primitive child and adjusts textarea form-control updates on the spread path; behavior is intentional but affects hydration-sensitive RCDATA and form defaults.
Overview
Aligns server HTML with how the client already mounts a host’s only renderable
{expr}child when the host also has a prop spread. The compiler no longer requires “no raw-HTML sources” before emitting markerlessssrChildText, so spread hosts stop wrapping that child in<!--[-->…<!--]-->. That fixes hydration text mismatches inside<textarea>(RCDATA keeps comments as literal default value) and wrong pre-hydration<select>selection when<option {...rest}>{label}</option>has novalueand framed label text could not matchdefaultValue.On the client, spread textarea updates no longer wipe authored child text:
applyFormControlValuesskips React-styledefaultValue = ''resets when the textarea has nested authored children, preserving Octane’s live text binding when the spread does not supplyvalue/defaultValue.Adds hydration coverage for spread/direct/ternary textarea cases and spread options, plus a conformance test for
<textarea {...rest}>{child}</textarea>updates.Reviewed by Cursor Bugbot for commit 49ef58c. Bugbot is set up for automated code reviews on this repo. Configure here.