Skip to content

Commit

Permalink
fix: emit app-migration-error event only when an error occurs
Browse files Browse the repository at this point in the history
Signed-off-by: The1111mp <[email protected]>
  • Loading branch information
1111mp committed Nov 6, 2024
1 parent 8c4c923 commit 39ebbf5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src-tauri/src/utils/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ pub fn init() -> Result<()> {
tauri::async_runtime::spawn(async {
if let Err(err) = update_schema().await {
log::error!(target: "migrate", "{err}");
}
// Delay 1s before sending events to the window
sleep(Duration::from_secs(1)).await;
if let Some(window) = handle::Handle::global().get_window() {
let _ = window.emit("app-migration-error", ());

// Delay 1s before sending events to the window
sleep(Duration::from_secs(1)).await;
if let Some(window) = handle::Handle::global().get_window() {
let _ = window.emit("app-migration-error", ());
}
}
});

Expand Down

0 comments on commit 39ebbf5

Please sign in to comment.