From 7788100dc596a89f9672fba239bc9f675af30591 Mon Sep 17 00:00:00 2001 From: Untone Date: Mon, 22 Jan 2024 20:59:49 +0300 Subject: [PATCH] notifications-stability-fix --- src/context/notifications.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/context/notifications.tsx b/src/context/notifications.tsx index f104faa6..bdbc1bb2 100644 --- a/src/context/notifications.tsx +++ b/src/context/notifications.tsx @@ -47,7 +47,11 @@ export const NotificationsProvider = (props: { children: JSX.Element }) => { const loadNotificationsGrouped = async (options: { after: number; limit?: number; offset?: number }) => { if (isAuthenticated() && notifierClient?.private) { - const { notifications: groups, total, unread } = await notifierClient.getNotifications(options) + const notificationsResult = await notifierClient.getNotifications(options) + const groups = notificationsResult?.notifications || [] + const total = notificationsResult?.total || 0 + const unread = notificationsResult?.unread || 0 + const newGroupsEntries = groups.reduce((acc, group: NotificationGroup) => { acc[group.id] = group return acc