notifications-fix

This commit is contained in:
Untone 2024-01-19 21:46:13 +03:00
parent ae85ec144b
commit e2d7710035
2 changed files with 3 additions and 4 deletions

View File

@ -64,7 +64,7 @@ export const NotificationGroup = (props: NotificationGroupProps) => {
return (
<>
<For each={props.notifications}>
<For each={props.notifications || []}>
{(n: Group) => (
<>
{t(reactionsCaption(n.id), { commentsCount: n.reactions.length })}{' '}

View File

@ -47,7 +47,7 @@ export const NotificationsProvider = (props: { children: JSX.Element }) => {
const loadNotificationsGrouped = async (options: { after: number; limit?: number; offset?: number }) => {
if (isAuthenticated() && notifierClient?.private) {
const { notifications: groups, unread, total } = await notifierClient.getNotifications(options)
const { notifications: groups, total, unread } = await notifierClient.getNotifications(options)
const newGroupsEntries = groups.reduce((acc, group: NotificationGroup) => {
acc[group.id] = group
return acc
@ -58,9 +58,8 @@ export const NotificationsProvider = (props: { children: JSX.Element }) => {
setNotificationEntities(newGroupsEntries)
console.debug(`[context.notifications] groups updated`, groups)
return groups
} else {
return []
}
return []
}
const sortedNotifications = createMemo(() => {