From bbeadcafaa062ee785e025125327684cfb22fc3c Mon Sep 17 00:00:00 2001 From: mkljczk Date: Tue, 18 Mar 2025 10:42:03 +0100 Subject: [PATCH] pl-fe: fix notification sorting Signed-off-by: mkljczk --- packages/pl-fe/src/reducers/notifications.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/pl-fe/src/reducers/notifications.ts b/packages/pl-fe/src/reducers/notifications.ts index 70ef8a5d3..b11579e75 100644 --- a/packages/pl-fe/src/reducers/notifications.ts +++ b/packages/pl-fe/src/reducers/notifications.ts @@ -47,12 +47,8 @@ const filterUnique = (notification: NotificationGroup, index: number, notificati notifications.findIndex(({ group_key }) => group_key === notification.group_key) === index; // For sorting the notifications -const comparator = (a: Pick, b: Pick) => { - const parse = (m: Pick) => parseId(m.most_recent_notification_id); - if (parse(a) < parse(b)) return 1; - if (parse(a) > parse(b)) return -1; - return 0; -}; +const comparator = (a: Pick, b: Pick) => + b.most_recent_notification_id.localeCompare(a.most_recent_notification_id); // Count how many notifications appear after the given ID (for unread count) const countFuture = (notifications: Array, lastId: string | number) =>