fix(settings): prevent profile input cursor jump#287
Conversation
|
@codex review |
Deploying vidbee-docs with
|
| Latest commit: |
dd92f85
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://48725f22.vidbee-docs.pages.dev |
| Branch Preview URL: | https://nexmoe-fix-profile-input.vidbee-docs.pages.dev |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dd92f851ec
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const settings = get(settingsAtom) | ||
| set(settingsAtom, { ...settings, [update.key]: update.value }) | ||
| } catch (error) { | ||
| set(settingsAtom, previousSettings) |
There was a problem hiding this comment.
Avoid stale snapshot rollback after failed save
Rolling back with set(settingsAtom, previousSettings) can overwrite newer user edits when multiple saveSettingAtom calls overlap. This happens in fast-changing inputs (for example, proxy onChange triggers repeated saves in pages/Settings.tsx), where call A captures an old snapshot, call B applies a newer value, and then A fails later: the catch block restores A's stale snapshot and discards B's update, leaving in-memory settings inconsistent with what was last typed (and potentially with persisted state, since successful calls no longer re-apply state after await).
Useful? React with 👍 / 👎.
Summary
This fixes issue #265 where the Profile name or path input cursor jumped while typing.