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) <noreply@anthropic.com>
This commit is contained in:
codytseng 2026-03-15 14:15:41 +08:00
parent e5e0918c93
commit cd86b3aac5

View file

@ -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])
}