From ff9ce464487644528943329bcf43de6e2bed022e Mon Sep 17 00:00:00 2001 From: Gigi Date: Sat, 18 Oct 2025 20:58:14 +0200 Subject: [PATCH] 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 --- src/components/Debug.tsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/components/Debug.tsx b/src/components/Debug.tsx index de2b8c73..920d261d 100644 --- a/src/components/Debug.tsx +++ b/src/components/Debug.tsx @@ -465,15 +465,10 @@ const Debug: React.FC = ({ 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 = ({ 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