From cd86b3aac57645d13fe4ade51ed66533ebcc487f Mon Sep 17 00:00:00 2001 From: codytseng Date: Sun, 15 Mar 2026 14:15:41 +0800 Subject: [PATCH] fix: deduplicate stored events against fetched events in notifications storedEvents from IndexedDB could contain the same event IDs as the fetched events, causing duplicate notifications to appear. Use the shared idSet to filter storedEvents so each event ID appears only once. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/components/NotificationList/index.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/NotificationList/index.tsx b/src/components/NotificationList/index.tsx index 0ee76d0..79f258f 100644 --- a/src/components/NotificationList/index.tsx +++ b/src/components/NotificationList/index.tsx @@ -222,7 +222,12 @@ const NotificationList = forwardRef((_, ref) => { }) if (storedEvents.length === 0) return filteredEvents - const filteredStoredEvents = storedEvents.filter((evt) => evt.pubkey !== pubkey) + const filteredStoredEvents = storedEvents.filter((evt) => { + if (evt.pubkey === pubkey) return false + if (idSet.has(evt.id)) return false + idSet.add(evt.id) + return true + }) if (!initialLoading) { return mergeTimelines([filteredEvents, filteredStoredEvents]) }