Fix stale settings saves resetting style selection#747
Merged
H-Chris233 merged 2 commits intoJul 11, 2026
Conversation
Contributor
PR Reviewer Guide 🔍(Review updated until commit 117aa1b)Here are some key observations to aid the review process:
|
H-Chris233
previously approved these changes
Jul 3, 2026
Collaborator
|
Could you please resolve conflicts for this? |
Collaborator
|
@appergb 你有时间的话cherry pick一下吧,作者不回复了,或者直接将此工作分配给我。 |
Collaborator
|
接管 |
Contributor
|
Persistent review updated to latest commit 117aa1b |
Collaborator
|
接管 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Summary
PreferencesStorewrite path so a stale settings payload cannot roll back the current active style pack.set_settingsandset_update_channelpersist.Root Cause
Generic settings saves send a complete
UserPreferencessnapshot. If the user switches to a local style pack and a later settings save uses an older snapshot, that stale payload can overwriteactive_style_pack_idand related legacy style fields, sending the app back to the previous formal/builtin style.Fix
The generic settings save path now treats style-pack preferences as owned by the style-pack commands. Before writing a generic settings payload,
PreferencesStore::set_preserving_current_style_preferencescopies the current store style fields under the same store lock used for the disk write and in-memory update. Style-pack commands still use the normal store write path, so intentional style changes continue to persist.Fixes #742.
Validation
rustfmt --edition 2021 --check openless-all/app/src-tauri/src/commands/settings.rs openless-all/app/src-tauri/src/persistence/preferences.rs openless-all/app/src-tauri/src/types.rscargo test settingscargo test sync_style_pack_preferencescargo test set_preserving_current_style_preferencesgit diff --checkPR Type
Bug fix, Enhancement
Description
Preserve active style preferences when generic settings saves overwrite them.
Add
write_settings_preserving_current_style_preferencesmethod toSettingsWriter.Modify
persist_settings,set_settings, andset_update_channelto use the new path.Add unit tests for the new behavior.
Diagram Walkthrough
File Walkthrough
settings.rs
Add style-preserving write path to SettingsWriteropenless-all/app/src-tauri/src/commands/settings.rs
write_settings_preserving_current_style_preferencesmethod toSettingsWritertrait.write_settingscalls with the preserving variant inpersist_settings_with_keyboard_applyandpersist_settings.set_settingsto read back the saved prefs after writing.settings_save_preserves_current_style_preferences_before_writeandpersist_settings_keeps_style_change_that_lands_before_write.preferences.rs
Add style-preserving write to PreferencesStoreopenless-all/app/src-tauri/src/persistence/preferences.rs
set_preserving_current_style_preferencesmethod toPreferencesStore.before writing.
set_preserving_current_style_preferences_keeps_store_style_fields.types.rs
Add preserve_style_preferences_from to UserPreferencesopenless-all/app/src-tauri/src/types.rs
preserve_style_preferences_frommethod toUserPreferences.default_mode,enabled_modes,active_style_pack_id,style_system_prompts, andcustom_style_promptsfrom another instance.