Skip to content

fix: Solid array item inputs lose focus and drop input after one keystroke - #101

Merged
lucas-barake merged 2 commits into
mainfrom
fix/solid-array-render-prop-tracking
Jul 10, 2026
Merged

fix: Solid array item inputs lose focus and drop input after one keystroke#101
lucas-barake merged 2 commits into
mainfrom
fix/solid-array-render-prop-tracking

Conversation

@lucas-barake

Copy link
Copy Markdown
Owner

Summary

Critical Solid-binding bug found in a deep review: you can only type one character into any array item field.

ArrayWrapper called props.children({ items: items(), ... }) with the items() memo read inside the tracked JSX expression. Form state is immutable, so every keystroke produces a new array reference, invalidating the tracked expression — Solid tears down and recreates the entire item subtree, destroying the active <input>. Typing Hello leaves the field containing H.

Fix

Expose items as a lazy getter on the ops object and invoke the render prop once, untracked, so <Index>/<For> handle reactivity granularly instead of the whole subtree re-running.

Tests

New FormSolidArrayField.test.tsx: the typing regression (Red: expected 'H' to be 'Hello' before the fix, Green after) plus append/remove tests that pass both before and after, proving the untrack does not regress add/remove reactivity. Full suite: 304 passed, types + lint clean.

Found by: sharded deep review with mandatory executed Red→Green validation; independently re-validated (Red re-confirmed on clean main, Green after patch).

…em inputs

The ArrayWrapper called props.children({ items: items(), ... }) with the
memo read inside the tracked JSX expression. Immutable state updates
produce a new array reference on every keystroke, so the whole render-prop
subtree was torn down and recreated, destroying the active input after
one character. Expose items as a lazy getter and invoke the render prop
untracked so <Index>/<For> own the granular reactivity.
@lucas-barake
lucas-barake merged commit fe71942 into main Jul 10, 2026
4 checks passed
@lucas-barake
lucas-barake deleted the fix/solid-array-render-prop-tracking branch July 10, 2026 02:32
@github-actions github-actions Bot mentioned this pull request Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant