mirror of
https://github.com/dergigi/boris.git
synced 2026-01-01 22:14:20 +01:00
fix: create and setup pool BEFORE loading accounts from localStorage
- NostrConnectAccount.fromJSON needs NostrConnectSigner.pool to be set - Move pool creation and setup before accounts.fromJSON() - This fixes 'Missing subscriptionMethod' error on page reload - Now bunker accounts can be properly restored from localStorage
This commit is contained in:
21
src/App.tsx
21
src/App.tsx
@@ -188,6 +188,16 @@ function App() {
|
||||
// Register common account types (needed for deserialization)
|
||||
registerCommonAccountTypes(accounts)
|
||||
|
||||
// Create relay pool and set it up BEFORE loading accounts
|
||||
// NostrConnectAccount.fromJSON needs this to restore the signer
|
||||
const pool = new RelayPool()
|
||||
NostrConnectSigner.pool = pool
|
||||
console.log('[bunker] ✅ Pool assigned to NostrConnectSigner (before account load)')
|
||||
|
||||
// Create a relay group for better event deduplication and management
|
||||
pool.group(RELAYS)
|
||||
console.log('[bunker] Created relay group with', RELAYS.length, 'relays (including local)')
|
||||
|
||||
// Load persisted accounts from localStorage
|
||||
try {
|
||||
const accountsJson = localStorage.getItem('accounts')
|
||||
@@ -235,17 +245,6 @@ function App() {
|
||||
}
|
||||
})
|
||||
|
||||
const pool = new RelayPool()
|
||||
|
||||
// Setup NostrConnectSigner to use the relay pool FIRST before any reconnections
|
||||
NostrConnectSigner.pool = pool
|
||||
console.log('[bunker] ✅ Pool assigned to NostrConnectSigner')
|
||||
|
||||
// Create a relay group for better event deduplication and management
|
||||
pool.group(RELAYS)
|
||||
console.log('Created relay group with', RELAYS.length, 'relays (including local)')
|
||||
console.log('Relay URLs:', RELAYS)
|
||||
|
||||
// Reconnect bunker signers when active account changes
|
||||
// Keep track of which accounts we've already reconnected to avoid double-connecting
|
||||
const reconnectedAccounts = new Set<string>()
|
||||
|
||||
Reference in New Issue
Block a user