You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Codemod remounts same-tag conditional inputs and loses user edits #2502
This reproduces with @octanejs/codemod built from main at 0d651902818c6011e1d86d3b52bce6739ec11b52, the published Octane 0.16.7 compiler and runtime, React 19.2.7, and Chromium 149.
exportfunctionView({ active }: {active: boolean}){return(<section>{active
? <inputdefaultValue="ready"/>
: <inputdefaultValue="later"/>}</section>);}
Run the codemod with Strong mode, compiler verification and project types.
Render the resulting component on the server and hydrate it with active: true.
Focus the input, type typed text, select characters 2 through 5, and update active to false.
Expected
Both branches have the same intrinsic type at the same child position and neither has a key. React retains the hydrated input node, the user's text, focus and selection.
Actual
The codemod reports a clean Strong result and emits two separate template arms.
The initial Octane hydration adopts the server node. Switching arms replaces that node, resets the live value to later, and loses focus and selection. Both renderers report zero hydration recoveries.
A control using one native input template with defaultValue={active ? "ready" : "later"} retains the node, text, focus and selection. A codemod fix should preserve the shared element where its key, props and evaluation order allow it. Distinct types or keys still require separate identities.
Activity