about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2023-11-27 18:40:20 -0600
committerGitHub <noreply@github.com>2023-11-27 16:40:20 -0800
commita741a201b990e35e96ea22bd8c503923db4683f9 (patch)
tree88f50da2b2afc038aa93f45fafdb6795a62391ed
parent26bbe0706897d3b00f35e77da9131d0305b633ef (diff)
downloadvoidsky-a741a201b990e35e96ea22bd8c503923db4683f9.tar.zst
Don't check unread if session doesn't exist (#2008)
-rw-r--r--src/state/queries/notifications/unread.tsx6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/state/queries/notifications/unread.tsx b/src/state/queries/notifications/unread.tsx
index 80b12112e..36bc6528f 100644
--- a/src/state/queries/notifications/unread.tsx
+++ b/src/state/queries/notifications/unread.tsx
@@ -70,8 +70,12 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
       },
 
       async checkUnread() {
+        const agent = getAgent()
+
+        if (!agent.session) return
+
         // count
-        const res = await getAgent().listNotifications({limit: 40})
+        const res = await agent.listNotifications({limit: 40})
         const filtered = res.data.notifications.filter(
           notif => !notif.isRead && !shouldFilterNotif(notif, moderationOpts),
         )