update the number correctly

This commit is contained in:
Hailey
2024-05-16 12:08:29 -07:00
parent cca22c44da
commit a205c86b45
@@ -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({