From 0e7aefb036da817b3c04c0a468c618556ac5763e Mon Sep 17 00:00:00 2001 From: Kieran Date: Wed, 23 Aug 2023 13:22:11 +0100 Subject: [PATCH] modify existing by index --- packages/system/src/note-collection.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/system/src/note-collection.ts b/packages/system/src/note-collection.ts index 706f79f9..97448dbd 100644 --- a/packages/system/src/note-collection.ts +++ b/packages/system/src/note-collection.ts @@ -150,9 +150,9 @@ export class FlatNoteStore extends HookedNoteStore b.id === a.id); - if (existing) { - existing.relays = appendDedupe(existing.relays, a.relays); + const existing = this.#events.findIndex(b => b.id === a.id); + if (existing !== -1) { + this.#events[existing].relays = appendDedupe(this.#events[existing].relays, a.relays); } } });