fix: duplicate relays

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

View File

@ -1,6 +1,6 @@
{
"name": "@snort/system-react",
"version": "1.2.11",
"version": "1.2.12",
"description": "React hooks for @snort/system",
"main": "dist/index.js",
"module": "src/index.ts",
@ -17,7 +17,7 @@
],
"dependencies": {
"@snort/shared": "^1.0.14",
"@snort/system": "^1.2.11",
"@snort/system": "^1.2.12",
"react": "^18.2.0"
},
"devDependencies": {

View File

@ -9,6 +9,7 @@
"jsx": "react-jsx",
"strict": true,
"declaration": true,
"declarationMap": true,
"inlineSourceMap": true,
"outDir": "dist",
"skipLibCheck": true

View File

@ -1,6 +1,6 @@
{
"name": "@snort/system",
"version": "1.2.11",
"version": "1.2.12",
"description": "Snort nostr system package",
"type": "module",
"main": "dist/index.js",

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);