fix(persons): prevent stale navigation from clobbering focused search input #44

Merged
marcel merged 1 commits from fix/34-persons-search-keystroke-loss into main 2026-03-20 22:00:27 +01:00
Owner

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 q state + qFocused flag, guard the sync $effect so it only writes q when the input is not focused, and add onfocus/onblur handlers.

Test plan

  • npm run test — all tests pass including the new regression test
  • npm run lint && npm run check — no errors in changed files
  • Manual: type quickly in the persons search field — no dropped characters
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 `q` state + `qFocused` flag, guard the sync `$effect` so it only writes `q` when the input is not focused, and add `onfocus`/`onblur` handlers. ## Test plan - [ ] `npm run test` — all tests pass including the new regression test - [ ] `npm run lint && npm run check` — no errors in changed files - [ ] Manual: type quickly in the persons search field — no dropped characters
marcel added 1 commit 2026-03-20 21:59:56 +01:00
fix(persons): prevent stale navigation from clobbering focused search input
All checks were successful
CI / Unit & Component Tests (pull_request) Successful in 2m12s
CI / Backend Unit Tests (pull_request) Successful in 1m58s
CI / E2E Tests (pull_request) Successful in 17m40s
CI / Unit & Component Tests (push) Successful in 1m58s
CI / Backend Unit Tests (push) Successful in 1m59s
CI / E2E Tests (push) Successful in 14m56s
da0d5495d0
The 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>
marcel merged commit da0d5495d0 into main 2026-03-20 22:00:27 +01:00
marcel deleted branch fix/34-persons-search-keystroke-loss 2026-03-20 22:00:28 +01:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: marcel/familienarchiv#44