fix: settings panel inputs unresponsive when no saved value - #32
Conversation
Controlled inputs swallowed keystrokes when value was null because editing state initialized to false, preventing draft updates. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
nox-0x
left a comment
There was a problem hiding this comment.
Clean, targeted fix for the controlled-input bug. Initializing editing: true for empty fields and removing the if (editing) guard on setDraft correctly resolves the root cause — the input is now truly controlled in all states. One minor UX note for a follow-up: when a user clicks "Change" on a field that already has a saved value, draft starts as "" rather than being seeded from the current value, so the input appears blank. Not a blocker here since the user must explicitly type and submit to overwrite, but worth a useState(value || "") on a future pass.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
nox-0x
left a comment
There was a problem hiding this comment.
Fix is correct and well-scoped. Initializing editing: true for empty fields and removing the if (editing) guard on setDraft cleanly resolves the controlled-input bug — no more swallowed keystrokes on first open. The simplified draft-always-owns-the-input pattern is the right call. As noted in the prior review, draft could be seeded from value on "Change" click to avoid a blank input, but that's a follow-up quality-of-life fix, not a blocker. Formatting-only changes in server files are fine.
- Type Hono app with NodeEnv bindings to fix c.env 'unknown' errors - Add `make fmt` target to auto-fix biome lint/formatting - Remove accidentally committed pnpm-lock.yaml Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
editingstate initialized tofalsefor empty fields, causingsetDraft()to be skipped inonChange— the input's controlledvaluenever updatedWhat changed
SettingRownow initializesediting: truewhenvalueis null (new/empty fields start in edit mode)draftstate directly (no conditional)Test plan
🤖 Generated with Claude Code