Skip to content

fix: settings panel inputs unresponsive when no saved value - #32

Merged
aterrylu merged 4 commits into
mainfrom
terry/fix-settings-inputs
Mar 16, 2026
Merged

fix: settings panel inputs unresponsive when no saved value#32
aterrylu merged 4 commits into
mainfrom
terry/fix-settings-inputs

Conversation

@aterrylu

Copy link
Copy Markdown
Owner

Summary

  • Fixed controlled input bug where typing was swallowed in settings panel when fields had no saved value (API key, base URL, auth token)
  • Root cause: editing state initialized to false for empty fields, causing setDraft() to be skipped in onChange — the input's controlled value never updated

What changed

  • SettingRow now initializes editing: true when value is null (new/empty fields start in edit mode)
  • Simplified input to always use draft state directly (no conditional)
  • Cancel button only shown when there's a saved value to revert to

Test plan

  • Open settings panel with no saved values → inputs should be immediately typeable
  • Save a value → field shows masked value with "Change" button
  • Click "Change" → input appears, type new value, save
  • Click "Change" then "Cancel" → reverts to showing saved value

🤖 Generated with Claude Code

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 nox-0x left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

aterrylu and others added 2 commits March 15, 2026 21:21
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 nox-0x left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@aterrylu
aterrylu merged commit b8a3163 into main Mar 16, 2026
1 check passed
@aterrylu
aterrylu deleted the terry/fix-settings-inputs branch March 16, 2026 04:25
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.

2 participants