Repository navigation
fix(octane): keep spread-held and children= textarea children live across updates - #1438
Merged
Merged
Conversation
…ross updates 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]>
trueadm
marked this pull request as ready for review
September 29, 2026 23:49
This was referenced Sep 30, 2026
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
<textarea>whose children come from a spread or achildren=prop emptied on every update after mount, both client-only and after hydration:render(ChildrenProp, { value: 'A' })gavedefaultValue"A"; a second render with'U'left''.This follows #1432, which fixed the same symptom for authored JSX children only.
Why
Octane textarea children are a live text binding (
docs/differences-from-react.md), not React's initial-only seed.applyFormControlValuesruns React'supdateTextareareset (defaultValue = '') on each update that has novalue/defaultValuewriter. That write replaces the textarea's children, so it detached the child binding's cached Text node, and every later update wrote into a node outside the element. #1432 skipped the reset when the host had authored JSX children (hasNestedChildren). Achildrensource resolved throughsetHostPropSourcesnever set that flag. That covers a spread,children=beside a spread, and a directchildren= value= defaultValue=cascade with no spread. A signal-held sibling prop in the same spread re-applies host props without re-running the child binding, so it hit the reset too.Changes
setHostPropSourcespasseshasNestedChildren || props.has('children').formChildrenon the controlled state. The child binding only holds DOM when it rendered last commit: it removes its node for an empty value and creates a fresh one for a non-empty value. Keying on the incoming props instead left the removed default's text in place when children took over:{defaultValue: 'Y'}→{children: 'B'}rendered"YB". The previous-commit rule matches thecreateElement('textarea', …)path exactly, including resetting on{}.docs/differences-from-react.mdnow says spread-held andchildren=textarea children are live too, and a patch changeset is added.Validation
pnpm format:check(repo-wide not run;pnpm format:files:checkon every changed file passes)pnpm typecheck(repo-wide not run;pnpm typecheck:fileson the changed runtime, test, and fixture passes)pnpm test(not run as a whole; see below)packages/octane/tests/hydration/textarea-children-prop-hydrate.test.ts: 20 cases ×octane/octane-prod. It covers{...{children}},{...rest},{...rest} children=, the no-spread cascade, and plainchildren=, each client-mounted and hydrated, then updated. It also covers a dirty value surviving default updates, removing and restoring the children writer,defaultValue→ children handoff, and the signal-sibling case in dev/prod × client/hydrate.children=never broke and stays as a control. With a current-props guard, the handoff test fails with"YB". The signal case fails 4/4 pre-fix.octane,octane-prod,octane-signals,octane-signals-prodprojects in full on the rebased head: 26,369 of 26,386 pass (--maxWorkers=6). The 17 failures are timeouts, and one knock-on of a timeout, inbehavior-root,hmr,hydration-ssr-diagnostics, andhydration/independent-parent(alloctane-prod). Rerun in isolation, those four files pass in both projects (568/568). Before the rebase, the same four projects ran fully green (25,316 + 474).benchmarks/bundle-size/run-minimal.mjs, before/after): +16 raw / +3–5 gzip, only in the 7 of 35 scenarios that reach form-control code; the rest are byte-identical.Risk / follow-ups
childrenanddefaultValuein the same commit is still undefined behaviour. React rejects that combination, and this change does not touch it.textarea-children-prop.tsrxto avoid an add/add conflict with fix(octane): render a textarea's children as one text value on both sides #1435'stextarea-children.tsrx. The working tree merged cleanly with fix(octane): render a textarea's children as one text value on both sides #1435 before the rebase.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Low Risk
Narrow textarea uncontrolled/defaultValue handling in form-control commits; behavior change is intentional parity with authored JSX children, with broad new test coverage.
Overview
Fixes
<textarea>fields that supply content via a spread orchildren=prop going blank after the first update (client mount and hydration). Octane treats textarea children as a live default; the form-control path was still clearingdefaultValueon commits without avalue/defaultValuewriter, which detached the child binding’s text node.Runtime: Host prop resolution now treats a
childrenprop like nested JSX children when applying form values. Controlled state tracks whether a children writer ran on the previous commit (formChildren) so the React-styledefaultValue = ''reset is skipped only while that binding may still own the textarea’s text—avoiding wrong defaults when switching fromdefaultValueto children.Docs/tests:
differences-from-react.mdand a patch changeset document spread/children=parity; new hydration tests cover spread,children=, handoffs withdefaultValue, and signal-driven sibling props.Reviewed by Cursor Bugbot for commit 89f17ed. Bugbot is set up for automated code reviews on this repo. Configure here.