Skip to content

Commit

Permalink
fix: saving out of date definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
BrewingWeasel committed Jul 24, 2024
1 parent f169b09 commit c7edd0d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,20 @@ async fn write_settings(
let conts = toml::to_string_pretty(&settings)?;

let mut state = state.0.lock().await;

// TODO: avoid this clone (arc)
let cloned_languages = state.settings.languages.clone();

for (language, specific_settings) in &cloned_languages {
if let Some(new_specific_settings) = settings.languages.get(language) {
if new_specific_settings.dicts != specific_settings.dicts {
if let Some(saved_details) = state.to_save.language_specific.get_mut(language) {
saved_details.cached_defs.clear();
}
}
}
}

state.settings = settings;

fs::write(config_file, conts)?;
Expand Down

0 comments on commit c7edd0d

Please sign in to comment.