From 2ebc6d6d6dd4e14f7bb6f91dd204c14b73ee6c8f Mon Sep 17 00:00:00 2001 From: Farooq Karimi Zadeh Date: Thu, 14 Sep 2023 17:53:15 +0330 Subject: [PATCH] complying to rule of hooks --- src/renderer/components/OtherAccountsUnreadBadge.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/renderer/components/OtherAccountsUnreadBadge.tsx b/src/renderer/components/OtherAccountsUnreadBadge.tsx index ff4f337bf9..d6a831e6cf 100644 --- a/src/renderer/components/OtherAccountsUnreadBadge.tsx +++ b/src/renderer/components/OtherAccountsUnreadBadge.tsx @@ -20,9 +20,10 @@ export default function OtherAccountsUnreadBadge(props: ComponentProps) { ] = useState(false) const settings = useSettingsStore()[0] - if (settings === null) return null useEffect(() => { + if (settings === null) return + if (settings.desktopSettings.syncAllAccounts === false) return let updating = false const update = () => { if (updating) return @@ -46,9 +47,9 @@ export default function OtherAccountsUnreadBadge(props: ComponentProps) { ) return update - }, [settings.desktopSettings.syncAllAccounts]) + }, [settings]) - if (settings.desktopSettings.syncAllAccounts && haveOtherAccountsUnread) { + if (settings && settings.desktopSettings.syncAllAccounts && haveOtherAccountsUnread) { return
} else { return null