refactor: simplify friends highlights loading to use cached contacts

- Remove redundant contact loading check
- Directly use contacts from centralized controller
- App.tsx already auto-loads contacts on login
- Clearer message indicating cached contacts are being used
- Faster execution since no contact loading needed
This commit is contained in:
Gigi
2025-10-18 20:58:14 +02:00
parent 1e6718fe1e
commit ff9ce46448

View File

@@ -465,15 +465,10 @@ const Debug: React.FC<DebugProps> = ({
return
}
// Ensure contacts are loaded first (will use cache if already loaded)
if (!contactsController.isLoadedFor(activeAccount.pubkey)) {
DebugBus.info('debug', 'Loading contacts first...')
await contactsController.start({ relayPool, pubkey: activeAccount.pubkey })
}
// Get contacts from centralized controller (should already be loaded by App.tsx)
const contacts = contactsController.getContacts()
if (contacts.size === 0) {
DebugBus.warn('debug', 'No friends found')
DebugBus.warn('debug', 'No friends found. Make sure you have contacts loaded.')
return
}
@@ -482,7 +477,7 @@ const Debug: React.FC<DebugProps> = ({
setIsLoadingHighlights(true)
setTLoadHighlights(null)
setTFirstHighlight(null)
DebugBus.info('debug', `Loading highlights from ${contacts.size} friends...`)
DebugBus.info('debug', `Loading highlights from ${contacts.size} friends (using cached contacts)...`)
let firstEventTime: number | null = null