From 50569b61b51ff8b71838a3a0c63cf8655b8b827a Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Mon, 9 Feb 2026 13:25:05 -0600 Subject: [PATCH] fix(window): sync localStorage value to Rust backend on init When the frontend initializes and finds useSystemTitleBar=true in localStorage, sync it to the Rust SQLite store. This handles migration from the localStorage-only era and ensures the Rust backend has the correct value for next startup. --- src/lib/stores/titleBarStore.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib/stores/titleBarStore.ts b/src/lib/stores/titleBarStore.ts index e80a697c9..f76501a58 100644 --- a/src/lib/stores/titleBarStore.ts +++ b/src/lib/stores/titleBarStore.ts @@ -41,8 +41,14 @@ export function initTitleBarStore(): void { if (savedSystem !== null) { useSystemTitleBar = savedSystem === 'true'; } - // Note: decorations are set by Rust at window creation (before show), - // so no need to call setDecorations() here on init. + // Sync localStorage value to Rust backend so it's available at next + // startup (before window creation). Handles migration from the + // localStorage-only era and keeps both stores in sync. + if (useSystemTitleBar) { + invoke('set_use_system_titlebar', { value: true }).catch((e) => { + console.error('[TitleBarStore] Failed to sync system titlebar to backend:', e); + }); + } } catch (e) { console.error('[TitleBarStore] Failed to initialize:', e); }