fix(window): hide window until webview renders to avoid empty frame

Create the window with visible:false so the empty frame + title bar
don't flash while the webview loads. The frontend calls
show_main_window from onMount (after first DOM paint) to reveal the
window with content already rendered.
This commit is contained in:
vicrodh committed 2026-02-09 14:34:24 -06:00
1 parent 68b227f46c
commit f284ac92bc
2 files changed
+18

No files matched your search

+11
View File
@@ -146,6 +146,15 @@ fn restart_app(app: tauri::AppHandle) {
app.restart();
}
#[tauri::command]
fn show_main_window(app: tauri::AppHandle) -> Result<(), String> {
if let Some(window) = app.get_webview_window("main") {
window.show().map_err(|e| format!("Failed to show window: {}", e))
} else {
Err("Main window not found".to_string())
}
}
pub fn run() {
// Load .env file if present (for development)
// Silently ignore if not found (production builds use compile-time env vars)
@@ -303,6 +312,7 @@ pub fn run() {
.min_inner_size(800.0, 600.0)
.decorations(use_system_titlebar)
.transparent(true)
.visible(false)
.resizable(true)
.zoom_hotkeys_enabled(true)
.build()
@@ -990,6 +1000,7 @@ pub fn run() {
config::window_settings::set_use_system_titlebar,
// App lifecycle commands
restart_app,
show_main_window,
// Log capture commands
logging::get_backend_logs,
logging::upload_logs_to_paste,