fix(settings): stop profile refreshes from wiping in-progress account edits
WHY THIS MATTERS Replicated live during the PR #365 review: type a new Display Name, tab into Organisation (blur fires the name autosave), and keep typing. When the name PATCH resolves, the Organisation input snaps back to the stored server value mid-keystroke and the typed text is gone - while the field is still focused. WHAT IS A HYDRATION-EFFECT CLOBBER The page keeps local input state and "hydrates" it from the profile context in an effect. The old effect wrote BOTH fields whenever EITHER profile value changed. Saving one field on blur refreshes the whole profile object, so the effect re-ran and overwrote the sibling input with the (stale) server value. This was latent before this PR - with click-to-save, a profile refresh never landed while the user was typing in the other field; blur-autosave made the race the common case, and this PR also removed the truthiness guard that used to soften it. HOW THE FIX WORKS The single combined effect becomes two effects, each keyed only to its own profile value, and each skips syncing while its input is the active element - the profile can never overwrite what the user is currently typing. When the field blurs, its own save handler reads the input state directly, so nothing is lost by skipping the sync. A regression test drives the real sequence (type name -> focus organisation -> type -> name save resolves with a refreshed profile) and asserts both inputs keep their typed values. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RuPCULDYgVsiCanRgbEy6W
| Repository | open-legal-products/mike |
|---|---|
| Author | Amal <mamalanand3@gmail.com> |
| Authored | |
| Parents | 44adf584 |
| Stats | 2 files changed , +49 , -4 |
| Part of | Add Google sign-in and personalised onboarding |
Capture this commit into my fork
Download a Markdown prompt that tells Claude how to port this
exact commit into your working tree. Run it via
claude -p < capture-commit-64f2e625.md
from inside the repo you want the change in.