You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an App with Store and Process plugin activated. The store cannot be saved if I restart the App with app_handle.restart(), but it can be saved via app_handle.exit(0).
Reproduction
The code is from my project. I save the app settings with store, and then call the app_handle.restart().
#[derive(Serialize, Deserialize)]
pub struct AppSettings {
language: String,
direct_generation: bool,
}
#[tauri::command]
pub fn get_app_settings(app_handle: AppHandle) -> AppSettings {
let store = app_handle.store("store.json").unwrap();
let language = store
.get("language")
.expect("No language setting is found.");
let direct_generation = store
.get("direct_generation")
.expect("No direct generation setting is found.");
AppSettings {
language: language.get("value").unwrap().as_str().unwrap().to_string(),
direct_generation: direct_generation.get("value").unwrap().as_bool().unwrap(),
}
}
#[tauri::command]
pub fn set_app_settings(app_handle: AppHandle, language: &str, direct_generation: bool) {
let store = app_handle.store("store.json").unwrap();
store.set("language", json!({"value": language}));
store.set("direct_generation", json!({"value": direct_generation}));
// This won't save the store, after restart it still shows the old setting values
app_handle.restart();
// This works, it will save the store and after I restart the app manually it shows the new setting values
// app_handle.exit(0);
}
Describe the bug
I have an App with Store and Process plugin activated. The store cannot be saved if I restart the App with
app_handle.restart()
, but it can be saved viaapp_handle.exit(0)
.Reproduction
The code is from my project. I save the app settings with store, and then call the
app_handle.restart()
.I have those plugins activated.
Expected behavior
Store should be saved during restart, just like it exits.
Full
tauri info
outputThe text was updated successfully, but these errors were encountered: