Skip to content

Commit

Permalink
fix: Workaound window sometimes only showing a white background (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
hrzlgnm authored Oct 26, 2024
1 parent bda3efd commit 7d84aa8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ chrono = "0.4.38"
console_error_panic_hook = "0.1.7"
console_log = "1.0.0"
futures = "0.3.30"
gloo-timers = { version = "0.3.0", features = ["futures"] }
icondata = "0.4.0"
js-sys = "0.3.70"
leptos = { version = "0.6.15", features = ["csr"] }
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ pub fn run() {
let splashscreen_window = app.get_webview_window("splashscreen").unwrap();
let main_window = app.get_webview_window("main").unwrap();
tauri::async_runtime::spawn(async move {
tokio::time::sleep(Duration::from_secs(3)).await;
tokio::time::sleep(Duration::from_millis(1_500)).await;
splashscreen_window.close().unwrap();
main_window.show().unwrap();
});
Expand Down
3 changes: 3 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use gloo_timers::future::TimeoutFuture;
use leptos::*;

use std::{
Expand Down Expand Up @@ -979,6 +980,8 @@ pub struct BrowsingSignal(RwSignal<bool>);
pub struct IsDesktopSignal(RwSignal<bool>);

async fn get_is_desktop(writer: RwSignal<bool>) {
// Workaround for is_dekstop request sometimes failing and resulting in a blank window
TimeoutFuture::new(50).await;
let is_desktop = invoke::<bool>("is_desktop", &()).await;
writer.update(|v| *v = is_desktop);
}
Expand Down

0 comments on commit 7d84aa8

Please sign in to comment.