From a205c86b453229abbb24d8f9dd4fcff9481f9116 Mon Sep 17 00:00:00 2001 From: Hailey Date: Thu, 16 May 2024 12:08:29 -0700 Subject: [PATCH] update the number correctly --- src/state/queries/notifications/unread.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/state/queries/notifications/unread.tsx b/src/state/queries/notifications/unread.tsx index a56eabe77d..dd7895282c 100644 --- a/src/state/queries/notifications/unread.tsx +++ b/src/state/queries/notifications/unread.tsx @@ -11,6 +11,7 @@ import BroadcastChannel from '#/lib/broadcast' import {logger} from '#/logger' import {useMutedThreads} from '#/state/muted-threads' import {useAgent, useSession} from '#/state/session' +import {decrementBadgeCount} from 'lib/notifications/notifications' import {useModerationOpts} from '../../preferences/moderation-opts' import {truncateAndInvalidate} from '../util' import {RQKEY as RQKEY_NOTIFS} from './feed' @@ -118,6 +119,12 @@ export function Provider({children}: React.PropsWithChildren<{}>) { // update & broadcast setNumUnread('') broadcast.postMessage({event: ''}) + + if (cacheRef.current.unreadCount >= 30) { + decrementBadgeCount(30) + } else { + decrementBadgeCount(cacheRef.current.unreadCount) + } }, async checkUnread({