diff --git a/src/components/Bookmarks.tsx b/src/components/Bookmarks.tsx index 498171fd..836a056a 100644 --- a/src/components/Bookmarks.tsx +++ b/src/components/Bookmarks.tsx @@ -75,8 +75,8 @@ const Bookmarks: React.FC = ({ relayPool, onLogout }) => { const fetchBookmarks = async () => { console.log('🔍 fetchBookmarks called, loading:', loading) - if (!relayPool || !activeAccount || loading) { - console.log('🔍 fetchBookmarks early return - relayPool:', !!relayPool, 'activeAccount:', !!activeAccount, 'loading:', loading) + if (!relayPool || !activeAccount) { + console.log('🔍 fetchBookmarks early return - relayPool:', !!relayPool, 'activeAccount:', !!activeAccount) return } @@ -84,6 +84,12 @@ const Bookmarks: React.FC = ({ relayPool, onLogout }) => { setLoading(true) console.log('🚀 NEW VERSION: Fetching bookmark list for pubkey:', activeAccount.pubkey) + // Set a timeout to ensure loading state gets reset + const timeoutId = setTimeout(() => { + console.log('⏰ Timeout reached, resetting loading state') + setLoading(false) + }, 15000) // 15 second timeout + // Get relay URLs from the pool const relayUrls = Array.from(relayPool.relays.values()).map(relay => relay.url) @@ -184,10 +190,12 @@ const Bookmarks: React.FC = ({ relayPool, onLogout }) => { } setBookmarks([bookmark]) + clearTimeout(timeoutId) setLoading(false) } catch (error) { console.error('Failed to fetch bookmarks:', error) + clearTimeout(timeoutId) setLoading(false) } }