diff --git a/components/RelayInitializer.tsx b/components/RelayInitializer.tsx index 640331d..039a2a8 100644 --- a/components/RelayInitializer.tsx +++ b/components/RelayInitializer.tsx @@ -7,6 +7,7 @@ import { useConnectivity } from '@/lib/db/services/ConnectivityService'; import { ConnectivityService } from '@/lib/db/services/ConnectivityService'; import { profileImageCache } from '@/lib/db/services/ProfileImageCache'; import { getSocialFeedCache } from '@/lib/db/services/SocialFeedCache'; +import { getContactCacheService } from '@/lib/db/services/ContactCacheService'; import { useDatabase } from '@/components/DatabaseProvider'; /** @@ -26,8 +27,15 @@ export default function RelayInitializer() { console.log('[RelayInitializer] Setting NDK instance in ProfileImageCache'); profileImageCache.setNDK(ndk); - // Initialize SocialFeedCache with NDK instance + // Initialize caches with NDK instance if (db) { + // Initialize ContactCacheService + try { + getContactCacheService(db); + console.log('[RelayInitializer] ContactCacheService initialized'); + } catch (error) { + console.error('[RelayInitializer] Error initializing ContactCacheService:', error); + } // Maximum number of retry attempts const MAX_RETRIES = 3; diff --git a/lib/social/socialFeedService.ts b/lib/social/socialFeedService.ts index 7fc4a5f..803d583 100644 --- a/lib/social/socialFeedService.ts +++ b/lib/social/socialFeedService.ts @@ -165,12 +165,13 @@ export class SocialFeedService { } else if (feedType === 'following') { // Following feed: Show content from followed users if (!Array.isArray(authors) || authors.length === 0) { - console.error('[SocialFeedService] Following feed requires authors'); + // Initial load often has no contacts yet - this is normal + console.log('[SocialFeedService] No contacts available for following feed yet, using fallback'); // For following feed, if no authors provided, use the POWR_PUBKEY_HEX as fallback // This ensures at least some content is shown if (POWR_PUBKEY_HEX) { - console.log('[SocialFeedService] Using POWR account as fallback for Following feed'); + console.log('[SocialFeedService] Using POWR account as fallback for initial Following feed load'); const fallbackAuthors = [POWR_PUBKEY_HEX]; return [