Don't check unread if session doesn't exist (#2008)

zio/stable
Eric Bailey 2023-11-27 18:40:20 -06:00 committed by GitHub
parent 26bbe07068
commit a741a201b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -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),
)