From de09ef29354c9eb8e094015a49d906d5509ef86c Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 16 Oct 2025 23:43:03 +0200 Subject: [PATCH] fix: avoid adding duplicate bunker relays to pool - Only add bunker relays that aren't already in the pool - Prevents duplicate subscriptions that could cause signing hangs - Improves stability when account is reconnected --- src/App.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 9b3a3ce8..8565fc8c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -275,8 +275,15 @@ function App() { try { // Add bunker's relays to the pool so signing requests can be sent/received const bunkerRelays = nostrConnectAccount.signer.relays || [] - console.log('[bunker] Adding bunker relays to pool:', bunkerRelays) - pool.group(bunkerRelays) + const existingRelayUrls = new Set(Array.from(pool.relays.keys())) + const newBunkerRelays = bunkerRelays.filter(url => !existingRelayUrls.has(url)) + + if (newBunkerRelays.length > 0) { + console.log('[bunker] Adding new bunker relays to pool:', newBunkerRelays) + pool.group(newBunkerRelays) + } else { + console.log('[bunker] Bunker relays already in pool') + } // Just ensure the signer is listening for responses - don't call connect() again // The fromBunkerURI already connected with permissions during login