fix(persons): prevent stale navigation from clobbering focused search input #44
Reference in New Issue
Block a user
Delete Branch "fix/34-persons-search-keystroke-loss"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #34 (persons page follow-up to PR #41)
Summary
The persons list search input used
value={data.q || ''}bound directly to server data — no local state at all — so every navigation completion reset the input to the stale URL value mid-typing. Same root cause as the home page fix in #41, different implementation pattern.Fix: introduce local
qstate +qFocusedflag, guard the sync$effectso it only writesqwhen the input is not focused, and addonfocus/onblurhandlers.Test plan
npm run test— all tests pass including the new regression testnpm run lint && npm run check— no errors in changed filesThe persons list search input used value={data.q || ''} bound directly to server data, so every navigation completion would reset it to the URL value mid-typing, dropping keystrokes just like issue #34 on the home page. Apply the same focus-guard fix: introduce local `q` state, a `qFocused` flag, and a guarded $effect that only syncs URL → state when the input is not focused. Adds a regression test matching the home-page pattern. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>