Skip to content

fix(settings): prevent profile input cursor jump#287

Merged
nexmoe merged 1 commit intomainfrom
nexmoe/fix-profile-input
Mar 1, 2026
Merged

fix(settings): prevent profile input cursor jump#287
nexmoe merged 1 commit intomainfrom
nexmoe/fix-profile-input

Conversation

@nexmoe
Copy link
Owner

@nexmoe nexmoe commented Mar 1, 2026

Summary

  • apply optimistic local state updates in saveSettingAtom before async persistence
  • rollback to previous settings when persistence fails
  • remove post-save overwrite path that could race with rapid input updates

This fixes issue #265 where the Profile name or path input cursor jumped while typing.

@nexmoe
Copy link
Owner Author

nexmoe commented Mar 1, 2026

@codex review

@cloudflare-workers-and-pages
Copy link

Deploying vidbee-docs with  Cloudflare Pages  Cloudflare Pages

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

View logs

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 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)

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@nexmoe nexmoe merged commit 252da94 into main Mar 1, 2026
4 checks passed
@nexmoe nexmoe deleted the nexmoe/fix-profile-input branch March 1, 2026 12:40
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.

1 participant