From 61cb9efc57cf67440a518b05cdcdfec276e19841 Mon Sep 17 00:00:00 2001 From: urlampranita Date: Wed, 4 Feb 2026 00:25:39 +0530 Subject: [PATCH 1/4] docs: add note about Jest warning after frontend tests Added documentation explaining that the 'Jest did not exit one second after the test run' warning is harmless when all tests pass. This helps new contributors understand the warning is expected behavior and not an indication of a problem. Fixes #1137 --- CONTRIBUTING.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 858431ef5..df6e05c41 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -64,6 +64,10 @@ cd frontend npm test ``` +> **Note:** After running the frontend tests, you may see a warning: +> `Jest did not exit one second after the test run has completed.` +> This is a known behavior and **does not indicate a problem** when all tests pass. It occurs due to async handles that Jest detects but doesn't affect test results or application functionality. + ### Backend - FastAPI From d58083e0248a447a018a3e76db5a640d0533cd68 Mon Sep 17 00:00:00 2001 From: urlampranita Date: Wed, 4 Feb 2026 09:30:41 +0530 Subject: [PATCH 2/4] docs: clarify Jest warning with precise explanation - Changed 'async handles' to 'open handles' for accuracy - Added examples of open handles (unclosed servers, DB connections, timers) - Added npx jest --detectOpenHandles command for debugging - Mentioned proper resource cleanup in afterEach/afterAll Addresses code review feedback --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index df6e05c41..c07b572fb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -66,7 +66,7 @@ npm test > **Note:** After running the frontend tests, you may see a warning: > `Jest did not exit one second after the test run has completed.` -> This is a known behavior and **does not indicate a problem** when all tests pass. It occurs due to async handles that Jest detects but doesn't affect test results or application functionality. +> This is a known behavior and **does not indicate a problem** when all tests pass. It occurs due to open handles (unclosed servers, DB connections, timers, etc.) that prevent the Node process from exiting cleanly. To identify the root cause, run `npx jest --detectOpenHandles` and ensure resources are properly closed in test teardown (`afterEach`/`afterAll`). ### Backend From 7e616a33ef12aa73d9becfc62a98e486ed3c076c Mon Sep 17 00:00:00 2001 From: urlampranita Date: Thu, 5 Feb 2026 11:51:20 +0530 Subject: [PATCH 3/4] Fix: Resolve Tauri Error 1412 (Chrome_WidgetWin_0) on Windows 11 - Add tauri-plugin-single-instance to prevent multiple WebView2 instances - Configure single-instance behavior to focus existing window - Add window label and skipTaskbar configuration for proper lifecycle - This fixes the window closing prematurely before connecting to backend Fixes #1147 --- frontend/src-tauri/Cargo.toml | 1 + frontend/src-tauri/src/main.rs | 10 ++++++++++ frontend/src-tauri/tauri.conf.json | 2 ++ 3 files changed, 13 insertions(+) diff --git a/frontend/src-tauri/Cargo.toml b/frontend/src-tauri/Cargo.toml index c16753a36..6efc9a441 100644 --- a/frontend/src-tauri/Cargo.toml +++ b/frontend/src-tauri/Cargo.toml @@ -37,6 +37,7 @@ tauri-plugin-process = "2.3.1" tauri-plugin-store = "2.4.1" tauri-plugin-updater = "2.9.0" tauri-plugin-opener = "2.5.2" +tauri-plugin-single-instance = "2.3.1" [features] # This feature is used for production builds or when a dev server is not specified, DO NOT REMOVE!! diff --git a/frontend/src-tauri/src/main.rs b/frontend/src-tauri/src/main.rs index 5b7aa6acc..ea991b1e0 100644 --- a/frontend/src-tauri/src/main.rs +++ b/frontend/src-tauri/src/main.rs @@ -190,6 +190,16 @@ fn prod(_app: &tauri::AppHandle, _resource_path: &std::path::Path) -> Result<(), fn main() { tauri::Builder::default() + .plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| { + // When a second instance is launched, focus the primary instance's window + let windows = app.webview_windows(); + windows + .values() + .next() + .expect("no window found") + .set_focus() + .expect("failed to set focus"); + })) .plugin(tauri_plugin_opener::init()) .plugin(tauri_plugin_updater::Builder::new().build()) .plugin(tauri_plugin_store::Builder::new().build()) diff --git a/frontend/src-tauri/tauri.conf.json b/frontend/src-tauri/tauri.conf.json index 8ad815dfd..0a12c0461 100644 --- a/frontend/src-tauri/tauri.conf.json +++ b/frontend/src-tauri/tauri.conf.json @@ -46,6 +46,7 @@ "app": { "windows": [ { + "label": "main", "title": "PictoPy", "width": 800, "height": 600, @@ -54,6 +55,7 @@ "resizable": true, "fullscreen": false, "maximized": false, + "skipTaskbar": false, "devtools": true } ], From ffcd8e51a477b8099557289da44006d8c2dc79f7 Mon Sep 17 00:00:00 2001 From: urlampranita Date: Fri, 6 Feb 2026 09:51:03 +0530 Subject: [PATCH 4/4] Refactor: Use graceful error handling in single-instance plugin - Replace .expect() calls with if-let pattern to prevent crashes - Use deterministic get_webview_window("main") instead of .values().next() - Improves stability by preventing panic on focus failure Addresses CodeRabbit review feedback --- frontend/src-tauri/src/main.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/frontend/src-tauri/src/main.rs b/frontend/src-tauri/src/main.rs index ea991b1e0..8f9202d95 100644 --- a/frontend/src-tauri/src/main.rs +++ b/frontend/src-tauri/src/main.rs @@ -192,13 +192,9 @@ fn main() { tauri::Builder::default() .plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| { // When a second instance is launched, focus the primary instance's window - let windows = app.webview_windows(); - windows - .values() - .next() - .expect("no window found") - .set_focus() - .expect("failed to set focus"); + if let Some(window) = app.get_webview_window("main") { + let _ = window.set_focus(); + } })) .plugin(tauri_plugin_opener::init()) .plugin(tauri_plugin_updater::Builder::new().build())