From 267fe58a8c5c28c3cb31b451a2daf89b618e2355 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Fri, 29 Aug 2025 02:02:53 +0800 Subject: [PATCH] fix: reduce screen flash with different background colors when app starts, closes #1915 (#1922) --- apps/readest-app/src-tauri/src/lib.rs | 4 +++- apps/readest-app/src/app/layout.tsx | 12 +++++++++++- apps/readest-app/src/app/library/page.tsx | 18 +++--------------- apps/readest-app/src/app/page.tsx | 11 ++--------- 4 files changed, 19 insertions(+), 26 deletions(-) diff --git a/apps/readest-app/src-tauri/src/lib.rs b/apps/readest-app/src-tauri/src/lib.rs index a6402b2d..3bf3a450 100644 --- a/apps/readest-app/src-tauri/src/lib.rs +++ b/apps/readest-app/src-tauri/src/lib.rs @@ -6,6 +6,7 @@ extern crate cocoa; #[macro_use] extern crate objc; +use tauri::utils::config::BackgroundThrottlingPolicy; #[cfg(target_os = "macos")] use tauri::TitleBarStyle; @@ -240,7 +241,8 @@ pub fn run() { eprintln!("Failed to initialize tauri_plugin_log: {e}"); }; - let win_builder = WebviewWindowBuilder::new(app, "main", WebviewUrl::default()); + let win_builder = WebviewWindowBuilder::new(app, "main", WebviewUrl::default()) + .background_throttling(BackgroundThrottlingPolicy::Disabled); #[cfg(desktop)] let win_builder = win_builder.inner_size(800.0, 600.0).resizable(true); diff --git a/apps/readest-app/src/app/layout.tsx b/apps/readest-app/src/app/layout.tsx index 6a85db4e..a5ab9dad 100644 --- a/apps/readest-app/src/app/layout.tsx +++ b/apps/readest-app/src/app/layout.tsx @@ -37,7 +37,6 @@ export const viewport = { maximumScale: 1, userScalable: false, viewportFit: 'cover', - themeColor: 'white', }; export default function RootLayout({ children }: { children: React.ReactNode }) { @@ -45,6 +44,17 @@ export default function RootLayout({ children }: { children: React.ReactNode }) {title} +