From 28eb7a2639aa1f2d6f915b2ba831e3508161c2fb Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 18 Feb 2026 15:23:20 +0200 Subject: [PATCH] fix: mini timer window blank due to hash routing mismatch The app uses createWebHashHistory but the mini timer window was opened with WebviewUrl::App("/mini-timer") which sets the URL path, not the hash fragment. Vue Router never matched the route, so the Dashboard rendered in a 300x64 window (appearing blank). Now loads root URL and sets window.location.hash via eval. Also shows/focuses the main window when closing the mini timer. --- src-tauri/src/commands.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/commands.rs b/src-tauri/src/commands.rs index a435b08..89546dd 100644 --- a/src-tauri/src/commands.rs +++ b/src-tauri/src/commands.rs @@ -1132,7 +1132,9 @@ pub fn open_mini_timer(app: tauri::AppHandle) -> Result<(), String> { return Ok(()); } - tauri::WebviewWindowBuilder::new(&app, "mini-timer", WebviewUrl::App("/mini-timer".into())) + // Load root URL — the app uses hash-based routing (createWebHashHistory), + // so we set the hash fragment via eval after the window is created. + let win = tauri::WebviewWindowBuilder::new(&app, "mini-timer", WebviewUrl::App(Default::default())) .title("Timer") .inner_size(300.0, 64.0) .always_on_top(true) @@ -1142,6 +1144,9 @@ pub fn open_mini_timer(app: tauri::AppHandle) -> Result<(), String> { .build() .map_err(|e| e.to_string())?; + // Navigate Vue Router to the mini-timer route via hash + win.eval("window.location.hash = '/mini-timer'").ok(); + Ok(()) } @@ -1150,6 +1155,11 @@ pub fn close_mini_timer(app: tauri::AppHandle) -> Result<(), String> { if let Some(window) = app.get_webview_window("mini-timer") { window.close().map_err(|e| e.to_string())?; } + // Show and focus the main window + if let Some(main) = app.get_webview_window("main") { + main.show().ok(); + main.set_focus().ok(); + } Ok(()) }