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
This commit is contained in:
Gigi
2025-10-16 23:43:03 +02:00
parent bcb28a63a7
commit de09ef2935

View File

@@ -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