prevent theme store mismatch

Signed-off-by: FTCHD <144691102+FTCHD@users.noreply.github.com>
This commit is contained in:
FTCHD
2025-10-28 21:30:29 +01:00
parent 8a7f24ec29
commit e11ec4e914
2 changed files with 5 additions and 9 deletions
+2 -2
View File
@@ -112,7 +112,7 @@ interface PersistedState {
hideStartup: boolean
theme: {
themeV2: {
tray: 'light' | 'dark' | undefined
}
}
@@ -258,7 +258,7 @@ export const usePersistedStore = create<PersistedState>()(
hideStartup: false,
theme: {
themeV2: {
tray: undefined,
},
}),
+3 -7
View File
@@ -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)