From 10894e17a513433f9894eb44edae4325d5728048 Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Mon, 16 Mar 2026 13:46:00 -0700 Subject: [PATCH] Fix phantom badges --- src/app/util/notifications.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/app/util/notifications.ts b/src/app/util/notifications.ts index 1e2ba311..39cb3544 100644 --- a/src/app/util/notifications.ts +++ b/src/app/util/notifications.ts @@ -19,7 +19,6 @@ import { import { on, call, - find, assoc, poll, prop, @@ -180,17 +179,12 @@ export const allNotifications = derived( for (const url of getSpaceUrlsFromGroupList($userGroupList)) { const spacePath = makeSpacePath(url) - const eventsById = eventsByIdByUrl.get(url) || new Map() - const latestEvent = first(sortEventsDesc(eventsById.values())) - - if (hasNotification(spacePath, latestEvent)) { - paths.add(spacePath) - } + const events = sortEventsDesc((eventsByIdByUrl.get(url) || new Map()).values()) if (hasNip29($relaysByUrl.get(url))) { for (const h of getSpaceRoomsFromGroupList(url, $userGroupList)) { const roomPath = makeRoomPath(url, h) - const latestEvent = find(e => e.tags.some(spec(["h", h])), eventsById.values()) + const latestEvent = events.find(e => e.tags.some(spec(["h", h]))) if (hasNotification(roomPath, latestEvent)) { paths.add(spacePath) @@ -200,7 +194,7 @@ export const allNotifications = derived( } else { const messagesPath = makeSpaceChatPath(url) - if (hasNotification(messagesPath, first(eventsById.values()))) { + if (hasNotification(messagesPath, first(events))) { paths.add(spacePath) paths.add(messagesPath) }