Skip to content

fix(windows): prevent stale async settings replies from reverting selected list - #40

Merged
turinglambdaai merged 2 commits into
mainfrom
fix/windows-settings-async-stale-state
Oct 21, 2026
Merged

turinglambdaai merged 2 commits into
mainfrom
fix/windows-settings-async-stale-state

Conversation

@turinglambdaai

Copy link
Copy Markdown
Owner

Problem

Windows SaveSettingAsync(key, value) runs after the UI has already applied a user's language, theme or selected-list change. When its async set_setting RPC completes, it unconditionally replaces the entire local settings_ object with the response. If the user changes lists or themes while another save is running, an older response can roll back the newer local last_selected_list_id (or language/theme) even though the UI remains on the newly selected list. This can cause incorrect selection restored on a later database open or after relaunch.

Change

Treat set-setting responses as persistence acknowledgements only. Still call result.get() to surface errors, but stop overwriting the full local state in the async success callback. All current callers already set the relevant local state synchronously before submitting the RPC. Document this cross-platform contract.

Verification

  • Windows x64 CI + packaged Product Acceptance green
  • Rapidly select 工作 → 生活 → 工作 while switching language/theme; current sidebar selection and new-task destination never spontaneously revert
  • Close/reopen DB and relaunch; last successfully persisted selected list is restored correctly
  • Errors from setting persistence still surface visibly
  • App startup settings are still sourced from the authoritative initial get_settings RPC

Independent of #32–#39 (changes only SaveSettingAsync and spec); run combined integration after merging. No merge/release until validation.

@turinglambdaai
turinglambdaai force-pushed the fix/windows-settings-async-stale-state branch from d16ca7f to 8f501d3 Compare October 21, 2026 03:20
@turinglambdaai
turinglambdaai merged commit 8136f08 into main Oct 21, 2026
8 of 10 checks passed
@turinglambdaai
turinglambdaai deleted the fix/windows-settings-async-stale-state branch October 21, 2026 03:41
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