mirror of
https://github.com/dergigi/boris.git
synced 2025-12-26 02:54:29 +01:00
fix: don't call connect() again on restored bunker signer
- fromBunkerURI() already calls connect() with permissions during login - Calling connect() again breaks the connection state - Just call open() to ensure subscription is active - This matches the pattern in applesauce examples which don't reconnect - Log final signer status including relays for debugging
This commit is contained in:
26
src/App.tsx
26
src/App.tsx
@@ -248,7 +248,8 @@ function App() {
|
||||
})
|
||||
|
||||
try {
|
||||
// Ensure the signer is listening for responses
|
||||
// Just ensure the signer is listening for responses - don't call connect() again
|
||||
// The fromBunkerURI already connected with permissions during login
|
||||
if (!nostrConnectAccount.signer.listening) {
|
||||
console.log('[bunker] Opening signer subscription...')
|
||||
await nostrConnectAccount.signer.open()
|
||||
@@ -260,25 +261,18 @@ function App() {
|
||||
console.log('[bunker] ✅ Signer already listening')
|
||||
}
|
||||
|
||||
// Reconnect with permissions if not already connected
|
||||
if (!nostrConnectAccount.signer.isConnected) {
|
||||
console.log('[bunker] Reconnecting with permissions...')
|
||||
const permissions = getDefaultBunkerPermissions()
|
||||
console.log('[bunker] Permissions:', permissions)
|
||||
await nostrConnectAccount.signer.connect(undefined, permissions)
|
||||
console.log('[bunker] ✅ Reconnected successfully, status:', {
|
||||
listening: nostrConnectAccount.signer.listening,
|
||||
isConnected: nostrConnectAccount.signer.isConnected
|
||||
})
|
||||
} else {
|
||||
console.log('[bunker] ✅ Already connected')
|
||||
}
|
||||
console.log('[bunker] Final signer status:', {
|
||||
listening: nostrConnectAccount.signer.listening,
|
||||
isConnected: nostrConnectAccount.signer.isConnected,
|
||||
remote: nostrConnectAccount.signer.remote,
|
||||
relays: nostrConnectAccount.signer.relays
|
||||
})
|
||||
|
||||
// Mark this account as reconnected
|
||||
reconnectedAccounts.add(account.id)
|
||||
console.log('[bunker] 🎉 Full reconnection complete')
|
||||
console.log('[bunker] 🎉 Signer ready for signing')
|
||||
} catch (error) {
|
||||
console.error('[bunker] ❌ Failed to reconnect:', error)
|
||||
console.error('[bunker] ❌ Failed to open signer:', error)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user