From a7a4c3e59cbdbfc19460c77cc856ba3e3dff2d08 Mon Sep 17 00:00:00 2001 From: Slinetrac Date: Thu, 26 Feb 2026 17:14:22 +0800 Subject: [PATCH] refactor(window): avoid double toggle (#6377) --- src-tauri/src/feat/window.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src-tauri/src/feat/window.rs b/src-tauri/src/feat/window.rs index 276eaba06..5e215ba46 100644 --- a/src-tauri/src/feat/window.rs +++ b/src-tauri/src/feat/window.rs @@ -6,14 +6,12 @@ use crate::utils::window_manager::WindowManager; use clash_verge_logging::{Type, logging}; use tokio::time::{Duration, timeout}; -/// Public API: open or close the dashboard pub async fn open_or_close_dashboard() { - open_or_close_dashboard_internal().await -} + if lightweight::is_in_lightweight_mode() { + let _ = lightweight::exit_lightweight_mode().await; + return; + } -/// Internal implementation for opening/closing dashboard -async fn open_or_close_dashboard_internal() { - let _ = lightweight::exit_lightweight_mode().await; let result = WindowManager::toggle_main_window().await; logging!(info, Type::Window, "Window toggle result: {result:?}"); }