fix(tray): resume rendering on second-launch restore (#497) (#501)

* fix(tray): resume rendering on second-launch restore (#497)

The single-instance plugin callback that handles a second launch (e.g.
via desktop / start-menu shortcut while the main window is hidden in
the tray) was missing the RESUME_RENDERING_JS injection that the tray-
icon restore path already does.

When the main window is closed to the tray, PAUSE_RENDERING_JS sets
window.__psyHidden = true, marks <html data-psy-native-hidden="true">,
and zeroes --psy-anim-speed. A global CSS rule then pauses every
animation under <html>. Page wrappers across the app use
.animate-fade-in (animation: fadeIn ... both) which starts at
opacity: 0 — so when a route mounts after navigation the new wrapper
stays frozen at opacity: 0 and the page looks blank.

Restoring via the tray icon worked because that path injects
RESUME_RENDERING_JS before show(); only the second-launch path was
missing it. Mirror the same eval here so both restore paths are
consistent.

Reported by netherguy4.

* docs: changelog entry for PR #501

Logs the tray second-launch restore-rendering fix in v1.46.0 "## Fixed".
This commit is contained in:
Frank Stellmacher
2026-05-07 18:59:55 +02:00
committed by GitHub
parent 9c9e4dc438
commit 3cabb64dbc
2 changed files with 15 additions and 0 deletions
+7
View File
@@ -649,6 +649,13 @@ pub fn run() {
.plugin(tauri_plugin_single_instance::init(|app, argv, _cwd| {
if !crate::cli::handle_cli_on_primary_instance(app, &argv) {
let window = app.get_webview_window("main").expect("no main window");
// The window may have been hidden via the close-to-tray path,
// which injects PAUSE_RENDERING_JS (sets `__psyHidden=true`,
// pauses CSS animations). Tray-icon restore mirrors this with
// RESUME_RENDERING_JS — second-launch restore must do the same,
// otherwise the webview comes back with rendering still paused
// and navigation looks blank (issue #497).
let _ = window.eval(RESUME_RENDERING_JS);
let _ = window.show();
let _ = window.unminimize();
let _ = window.set_focus();