From a741a201b990e35e96ea22bd8c503923db4683f9 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Mon, 27 Nov 2023 18:40:20 -0600 Subject: Don't check unread if session doesn't exist (#2008) --- src/state/queries/notifications/unread.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') 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), ) -- cgit 1.4.1