Skip to content

Commit

Permalink
complying to rule of hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
farooqkz committed Sep 14, 2023
1 parent be8a71d commit 2ebc6d6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/renderer/components/OtherAccountsUnreadBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ export default function OtherAccountsUnreadBadge(props: ComponentProps) {
] = useState<boolean>(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
Expand All @@ -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 <div className='unread-badge' style={{ ...props }} />
} else {
return null
Expand Down

0 comments on commit 2ebc6d6

Please sign in to comment.