From b8239c6e1b6bfa523568036f64caea8e98258594 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 18 Feb 2026 15:26:44 +0200 Subject: [PATCH] fix: mini timer renders via window label instead of hash routing The mini timer window was blank because hash-based routing (createWebHashHistory) doesn't work with Tauri's WebviewUrl path. Now App.vue detects the mini timer by checking getCurrentWindow().label === 'mini-timer' and renders the MiniTimer component directly, bypassing the router entirely. --- src-tauri/src/commands.rs | 9 +++------ src/App.vue | 38 +++++++++++++++++++++++++------------- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/src-tauri/src/commands.rs b/src-tauri/src/commands.rs index 89546dd..fe191c1 100644 --- a/src-tauri/src/commands.rs +++ b/src-tauri/src/commands.rs @@ -1132,9 +1132,9 @@ pub fn open_mini_timer(app: tauri::AppHandle) -> Result<(), String> { return Ok(()); } - // 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())) + // Load root URL — App.vue detects the "mini-timer" window label + // and renders MiniTimer directly, bypassing the router. + tauri::WebviewWindowBuilder::new(&app, "mini-timer", WebviewUrl::App(Default::default())) .title("Timer") .inner_size(300.0, 64.0) .always_on_top(true) @@ -1144,9 +1144,6 @@ 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(()) } diff --git a/src/App.vue b/src/App.vue index 74cae74..b04c195 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,12 +1,16 @@