From 57177d44098cfd692cc11928ab9a78f1806be30e Mon Sep 17 00:00:00 2001 From: phoval <89515930+phoval@users.noreply.github.com> Date: Mon, 10 Jun 2024 05:13:27 +0200 Subject: [PATCH] fix: undefined browser (#3011) electron is not available --- web/hooks/useLoadTheme.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/hooks/useLoadTheme.ts b/web/hooks/useLoadTheme.ts index dfa8d263d..8afba27c4 100644 --- a/web/hooks/useLoadTheme.ts +++ b/web/hooks/useLoadTheme.ts @@ -29,11 +29,11 @@ export const useLoadTheme = async () => { const setNativeTheme = useCallback( (nativeTheme: NativeThemeProps) => { if (nativeTheme === 'dark') { - window?.electronAPI.setNativeThemeDark() + window?.electronAPI?.setNativeThemeDark() setTheme('dark') localStorage.setItem('nativeTheme', 'dark') } else { - window?.electronAPI.setNativeThemeLight() + window?.electronAPI?.setNativeThemeLight() setTheme('light') localStorage.setItem('nativeTheme', 'light') }