From 6d8a0a5640d32ff1867484dddbf7976e4d96d8d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Tue, 10 Sep 2024 13:01:19 +0200 Subject: [PATCH] pl-fe: Fix counting deduplicated notifications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- packages/pl-fe/src/reducers/notifications.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/pl-fe/src/reducers/notifications.ts b/packages/pl-fe/src/reducers/notifications.ts index afb7ae6b2..5106c12f9 100644 --- a/packages/pl-fe/src/reducers/notifications.ts +++ b/packages/pl-fe/src/reducers/notifications.ts @@ -128,7 +128,7 @@ type MinifiedNotification = ReturnType; // Count how many notifications appear after the given ID (for unread count) const countFuture = (notifications: ImmutableOrderedMap, lastId: string | number) => notifications.reduce((acc, notification) => { - if (parseId(notification.id) > parseId(lastId)) { + if (!notification.duplicate && parseId(notification.id) > parseId(lastId)) { return acc + 1; } else { return acc; @@ -138,7 +138,7 @@ const countFuture = (notifications: ImmutableOrderedMap { const top = state.top; - if (!top) state = state.update('unread', unread => unread + 1); + if (!top && !notification.duplicate) state = state.update('unread', unread => unread + 1); return state.update('items', map => { if (top && map.size > 40) {