From faf8e62120566cba35b99fcead978985d46837f2 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sat, 4 Jun 2022 18:34:54 -0300 Subject: [PATCH] maybe fix a bug with calling sub.sub() --- package.json | 2 +- pool.js | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 91a5321..90e19db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nostr-tools", - "version": "0.23.1", + "version": "0.23.3", "description": "Tools for making a Nostr client.", "repository": { "type": "git", diff --git a/pool.js b/pool.js index 12e6735..ada6e32 100644 --- a/pool.js +++ b/pool.js @@ -26,10 +26,9 @@ export function relayPool() { const activeSubscriptions = {} - const sub = ( - {cb, filter, beforeSend}, - id = Math.random().toString().slice(2) - ) => { + const sub = ({cb, filter, beforeSend}, id) => { + if (!id) id = Math.random().toString().slice(2) + const subControllers = Object.fromEntries( Object.values(relays) .filter(({policy}) => policy.read)