diff --git a/lib/store.ts b/lib/store.ts index 2c66b82..d92a9db 100644 --- a/lib/store.ts +++ b/lib/store.ts @@ -112,7 +112,7 @@ interface PersistedState { hideStartup: boolean - theme: { + themeV2: { tray: 'light' | 'dark' | undefined } } @@ -258,7 +258,7 @@ export const usePersistedStore = create()( hideStartup: false, - theme: { + themeV2: { tray: undefined, }, }), diff --git a/lib/tray.ts b/lib/tray.ts index 638a728..3a903c1 100644 --- a/lib/tray.ts +++ b/lib/tray.ts @@ -25,13 +25,9 @@ async function getTray() { } async function resolveTrayIconForTheme() { - const existingTheme = usePersistedStore.getState().theme + const existingTheme = usePersistedStore.getState().themeV2 - if (typeof existingTheme === 'string') { - usePersistedStore.setState({ theme: { tray: undefined } }) - } - - if (existingTheme.tray) { + if ('tray' in existingTheme && existingTheme.tray) { return existingTheme.tray === 'dark' ? 'icons/favicon/icon.png' : 'icons/favicon/icon-light.png' @@ -84,7 +80,7 @@ async function resolveTrayIconForTheme() { console.log('[resolveTrayIconForTheme] theme', theme) - usePersistedStore.setState({ theme: { tray: theme } }) + usePersistedStore.setState({ themeV2: { tray: theme } }) const pickedPath = theme === 'dark' ? 'icons/favicon/icon.png' : 'icons/favicon/icon-light.png' console.log('[resolveTrayIconForTheme] pickedPath', pickedPath)