notifications-fix
This commit is contained in:
parent
ae85ec144b
commit
e2d7710035
|
@ -64,7 +64,7 @@ export const NotificationGroup = (props: NotificationGroupProps) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<For each={props.notifications}>
|
<For each={props.notifications || []}>
|
||||||
{(n: Group) => (
|
{(n: Group) => (
|
||||||
<>
|
<>
|
||||||
{t(reactionsCaption(n.id), { commentsCount: n.reactions.length })}{' '}
|
{t(reactionsCaption(n.id), { commentsCount: n.reactions.length })}{' '}
|
||||||
|
|
|
@ -47,7 +47,7 @@ export const NotificationsProvider = (props: { children: JSX.Element }) => {
|
||||||
|
|
||||||
const loadNotificationsGrouped = async (options: { after: number; limit?: number; offset?: number }) => {
|
const loadNotificationsGrouped = async (options: { after: number; limit?: number; offset?: number }) => {
|
||||||
if (isAuthenticated() && notifierClient?.private) {
|
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) => {
|
const newGroupsEntries = groups.reduce((acc, group: NotificationGroup) => {
|
||||||
acc[group.id] = group
|
acc[group.id] = group
|
||||||
return acc
|
return acc
|
||||||
|
@ -58,9 +58,8 @@ export const NotificationsProvider = (props: { children: JSX.Element }) => {
|
||||||
setNotificationEntities(newGroupsEntries)
|
setNotificationEntities(newGroupsEntries)
|
||||||
console.debug(`[context.notifications] groups updated`, groups)
|
console.debug(`[context.notifications] groups updated`, groups)
|
||||||
return groups
|
return groups
|
||||||
} else {
|
|
||||||
return []
|
|
||||||
}
|
}
|
||||||
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
const sortedNotifications = createMemo(() => {
|
const sortedNotifications = createMemo(() => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user