fix: duplicate relays

This commit is contained in:
2024-02-27 17:45:35 +00:00
parent 5796892e54
commit be48c9cc37
4 changed files with 6 additions and 5 deletions

View File

@ -1,4 +1,4 @@
import { SortedMap } from "@snort/shared";
import { SortedMap, dedupe } from "@snort/shared";
import { EventExt, EventType, TaggedNostrEvent } from ".";
import { findTag } from "./utils";
import EventEmitter from "eventemitter3";
@ -73,7 +73,7 @@ export class KeyedReplaceableNoteStore extends HookedNoteStore {
const existingCreated = existing?.created_at ?? 0;
if (a.created_at > existingCreated) {
if (existing) {
a.relays.push(...existing.relays);
a.relays = dedupe([...existing.relays, ...a.relays]);
}
this.#events.set(keyOnEvent, a);
changes.push(a);