Skip to content

fix(octane): keep spread-held and children= textarea children live across updates - #1438

Merged
trueadm merged 1 commit into
mainfrom
claude/trusting-jang-6f3d31
Sep 30, 2026
Merged

trueadm merged 1 commit into
mainfrom
claude/trusting-jang-6f3d31

Conversation

@trueadm

@trueadm trueadm commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A <textarea> whose children come from a spread or a children= prop emptied on every update after mount, both client-only and after hydration:

export function ChildrenProp(props: { value: any }) @{
	<section><textarea {...{ children: props.value }} /></section>
}

render(ChildrenProp, { value: 'A' }) gave defaultValue "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. applyFormControlValues runs React's updateTextarea reset (defaultValue = '') on each update that has no value/defaultValue writer. 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). A children source resolved through setHostPropSources never set that flag. That covers a spread, children= beside a spread, and a direct children= 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

  • setHostPropSources passes hasNestedChildren || props.has('children').
  • The textarea reset is skipped when a children writer was present at the previous commit, tracked as formChildren on 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 the createElement('textarea', …) path exactly, including resetting on {}.
  • docs/differences-from-react.md now says spread-held and children= textarea children are live too, and a patch changeset is added.

Validation

  • pnpm format:check (repo-wide not run; pnpm format:files:check on every changed file passes)
  • pnpm typecheck (repo-wide not run; pnpm typecheck:files on the changed runtime, test, and fixture passes)
  • pnpm test (not run as a whole; see below)
  • targeted tests:
    • New 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 plain children=, 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.
    • Seen failing first: with fix(octane): serialize a spread host's sole child unframed and keep textarea children live #1432's guard, 14/16 per project fail. Plain 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-prod projects 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, in behavior-root, hmr, hydration-ssr-diagnostics, and hydration/independent-parent (all octane-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).
    • Bundle (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

Provenance

  • An agent produced this diff (agent-authored)

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with 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 or children= 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 clearing defaultValue on commits without a value/defaultValue writer, which detached the child binding’s text node.

Runtime: Host prop resolution now treats a children prop like nested JSX children when applying form values. Controlled state tracks whether a children writer ran on the previous commit (formChildren) so the React-style defaultValue = '' reset is skipped only while that binding may still own the textarea’s text—avoiding wrong defaults when switching from defaultValue to children.

Docs/tests: differences-from-react.md and a patch changeset document spread/children= parity; new hydration tests cover spread, children=, handoffs with defaultValue, 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.

…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]>
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Sep 29, 2026
@github-actions
github-actions Bot marked this pull request as draft September 29, 2026 23:19
@trueadm
trueadm marked this pull request as ready for review September 29, 2026 23:49
@trueadm
trueadm merged commit 3f9b16b into main Sep 30, 2026
59 checks passed
@trueadm
trueadm deleted the claude/trusting-jang-6f3d31 branch September 30, 2026 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant