File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -64,8 +64,21 @@ class NDKSvelte extends NDK {
6464 if ( existingEvent . created_at ! >= e . created_at ! ) return ;
6565 }
6666
67+ // Check if the event is marked as deleted
68+ const isDeleted = e . isParamReplaceable ( ) && e . hasTag ( "deleted" ) ;
69+
70+ // Update the event map
6771 eventMap . set ( dedupKey , e as T ) ;
6872
73+ // If the event is deleted and skipDeleted is true (default), remove it from the list
74+ if ( isDeleted && opts ?. skipDeleted !== false ) {
75+ const index = eventList . findIndex ( event => event . deduplicationKey ( ) === dedupKey ) ;
76+ if ( index !== - 1 ) {
77+ eventList . splice ( index , 1 ) ;
78+ }
79+ return ;
80+ }
81+
6982 // Update the reactive event list inserting the event in the right position according to the created_at timestamp
7083 const pos = eventList . findIndex ( event => event . created_at ! < e . created_at ! ) ;
7184 eventList . splice ( pos , 0 , e as T ) ;
You can’t perform that action at this time.
0 commit comments