about summary refs log tree commit diff
path: root/src/state/queries
diff options
context:
space:
mode:
Diffstat (limited to 'src/state/queries')
-rw-r--r--src/state/queries/messages/list-converations.ts17
-rw-r--r--src/state/queries/notifications/unread.tsx2
2 files changed, 5 insertions, 14 deletions
diff --git a/src/state/queries/messages/list-converations.ts b/src/state/queries/messages/list-converations.ts
index 3939ab8e3..8319fdefe 100644
--- a/src/state/queries/messages/list-converations.ts
+++ b/src/state/queries/messages/list-converations.ts
@@ -15,7 +15,6 @@ import {useCurrentConvoId} from '#/state/messages/current-convo-id'
 import {useModerationOpts} from '#/state/preferences/moderation-opts'
 import {DM_SERVICE_HEADERS} from '#/state/queries/messages/const'
 import {useAgent, useSession} from '#/state/session'
-import {decrementBadgeCount} from 'lib/notifications/notifications'
 
 export const RQKEY = ['convo-list']
 type RQPageParam = string | undefined
@@ -135,18 +134,10 @@ export function useOnMarkAsRead() {
   return useCallback(
     (chatId: string) => {
       queryClient.setQueryData(RQKEY, (old: ConvoListQueryData) => {
-        return optimisticUpdate(chatId, old, convo => {
-          // We only want to decrement the badge by one no matter the unread count, since we only increment once per
-          // sender regardless of message count
-          if (convo.unreadCount > 0) {
-            decrementBadgeCount(1)
-          }
-
-          return {
-            ...convo,
-            unreadCount: 0,
-          }
-        })
+        return optimisticUpdate(chatId, old, convo => ({
+          ...convo,
+          unreadCount: 0,
+        }))
       })
     },
     [queryClient],
diff --git a/src/state/queries/notifications/unread.tsx b/src/state/queries/notifications/unread.tsx
index 9d35ee19f..acc68c360 100644
--- a/src/state/queries/notifications/unread.tsx
+++ b/src/state/queries/notifications/unread.tsx
@@ -119,7 +119,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
         // update & broadcast
         setNumUnread('')
         broadcast.postMessage({event: ''})
-        decrementBadgeCount(Math.min(cacheRef.current.unreadCount, 30))
+        decrementBadgeCount('reset')
       },
 
       async checkUnread({