From fa8d158f3634f13ed2dddb207fac1b57d4e7e00e Mon Sep 17 00:00:00 2001 From: NimBold Date: Thu, 27 Aug 2026 22:02:53 +0330 Subject: [PATCH] test(startup): isolate full renderer without logger IPC (#37) - Issue #37: test the full 1.4.0 renderer without the module-time logger query.\n- Keep the normal native window lifecycle and all other startup code intact.\n\nRefs #37. --- src-tauri/src/lib.rs | 26 -------------------------- src/main.tsx | 4 +--- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index e1f0f2c..b1c0766 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -3993,18 +3993,6 @@ fn mark_main_window_startup_complete(app_handle: &tauri::AppHandle) { } } -#[cfg(target_os = "windows")] -fn reveal_main_window(app_handle: &tauri::AppHandle) { - if let Some(window) = app_handle.get_webview_window("main") { - if let Err(error) = window.set_focusable(true) { - log::warn!("Could not make the main window focusable: {error}"); - } - if let Err(error) = window.show() { - eprintln!("Failed to reveal the main window: {error}"); - } - } -} - fn restore_pending_main_window(app_handle: &tauri::AppHandle) { if app_handle .try_state::() @@ -18553,17 +18541,6 @@ pub fn run() { main_window_builder = main_window_builder .inner_size(startup_size.width as f64, startup_size.height as f64) .prevent_overflow(); - #[cfg(target_os = "windows")] - { - // Wry installs its parent WM_SETFOCUS handler while WebView2 - // is still being initialized. Keep the host hidden and - // non-activatable until RunEvent::Ready so Windows cannot - // re-enter that handler during native construction. - main_window_builder = main_window_builder - .visible(false) - .focused(false) - .focusable(false); - } main_window_builder .build() .map_err(|error| format!("failed to create main window: {error}"))?; @@ -19901,9 +19878,6 @@ pub fn run() { .run(|app_handle, event| match event { tauri::RunEvent::Ready => { mark_main_window_startup_complete(app_handle); - #[cfg(target_os = "windows")] - reveal_main_window(app_handle); - #[cfg(not(target_os = "windows"))] restore_pending_main_window(app_handle); } #[cfg(target_os = "macos")] diff --git a/src/main.tsx b/src/main.tsx index b060cfe..5c3f88d 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -10,14 +10,12 @@ import "./index.css"; import { i18nReady } from "./i18n"; import { ErrorBoundary } from "./components/ErrorBoundary"; import { ToastProvider } from "./contexts/ToastContext"; -import { error as logError, warn as logWarn, initLogger } from "./utils/logger"; +import { error as logError, warn as logWarn } from "./utils/logger"; import { getCurrentWindow } from '@tauri-apps/api/window'; import { invokeCommand as invoke } from './ipc'; const isPropertiesWindow = getCurrentWindow().label.startsWith('properties-'); -void initLogger(); - const serializeConsoleArguments = (values: unknown[]) => values.map(value => { if (value instanceof Error) return `${value.name}: ${value.message}\n${value.stack || ''}`; if (typeof value === 'string') return value;