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:
parent
e5e0918c93
commit
cd86b3aac5
1 changed files with 6 additions and 1 deletions
|
|
@ -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])
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue