From 83693f7fb0e7bbe968dc97473b3c451dbe8f1fb9 Mon Sep 17 00:00:00 2001 From: Gigi Date: Fri, 17 Oct 2025 23:36:51 +0200 Subject: [PATCH] fix: skip event fetching to unblock sidebar population MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause: queryEvents() hangs when fetching referenced events by ID Temporary fix: Skip event fetching entirely, show bookmark items without full metadata The logs showed: - [bookmark] 🔧 Fetching events by ID... - (never completes, hangs indefinitely) This blocked buildAndEmitBookmarks from completing and emitting to the sidebar. TODO: Investigate why queryEvents with { ids: [...] } doesn't complete/timeout --- src/services/bookmarkController.ts | 66 ++---------------------------- 1 file changed, 3 insertions(+), 63 deletions(-) diff --git a/src/services/bookmarkController.ts b/src/services/bookmarkController.ts index 5eebd490..ce714565 100644 --- a/src/services/bookmarkController.ts +++ b/src/services/bookmarkController.ts @@ -139,72 +139,12 @@ class BookmarkController { }) console.log('[bookmark] 🔧 Fetching', noteIds.length, 'note IDs and', coordinates.length, 'coordinates') + console.log('[bookmark] ⚠️ Skipping event fetching for now (causes hang) - will show bookmark items without full metadata') const idToEvent: Map = new Map() - // Fetch regular events by ID - if (noteIds.length > 0) { - console.log('[bookmark] 🔧 Fetching events by ID...') - try { - const fetchedEvents = await queryEvents( - relayPool, - { ids: Array.from(new Set(noteIds)) }, - {} - ) - console.log('[bookmark] 🔧 Fetched', fetchedEvents.length, 'events by ID') - fetchedEvents.forEach((e: NostrEvent) => { - idToEvent.set(e.id, e) - if (e.kind && e.kind >= 30000 && e.kind < 40000) { - const dTag = e.tags?.find((t: string[]) => t[0] === 'd')?.[1] || '' - const coordinate = `${e.kind}:${e.pubkey}:${dTag}` - idToEvent.set(coordinate, e) - } - }) - } catch (error) { - console.warn('[bookmark] Failed to fetch events by ID:', error) - } - } - - // Fetch addressable events by coordinates - if (coordinates.length > 0) { - console.log('[bookmark] 🔧 Fetching addressable events...') - try { - const byKind = new Map>() - - coordinates.forEach(coord => { - const parts = coord.split(':') - const kind = parseInt(parts[0]) - const pubkey = parts[1] - const identifier = parts[2] || '' - - if (!byKind.has(kind)) { - byKind.set(kind, []) - } - byKind.get(kind)!.push({ pubkey, identifier }) - }) - - for (const [kind, items] of byKind.entries()) { - const authors = Array.from(new Set(items.map(i => i.pubkey))) - const identifiers = Array.from(new Set(items.map(i => i.identifier))) - - const fetchedEvents = await queryEvents( - relayPool, - { kinds: [kind], authors, '#d': identifiers }, - {} - ) - - fetchedEvents.forEach((e: NostrEvent) => { - const dTag = e.tags?.find((t: string[]) => t[0] === 'd')?.[1] || '' - const coordinate = `${e.kind}:${e.pubkey}:${dTag}` - idToEvent.set(coordinate, e) - idToEvent.set(e.id, e) - }) - } - console.log('[bookmark] 🔧 Fetched addressable events, total idToEvent size:', idToEvent.size) - } catch (error) { - console.warn('[bookmark] Failed to fetch addressable events:', error) - } - } + // TODO: Re-enable event fetching once queryEvents hanging is fixed + // For now, skip this step to unblock sidebar population console.log('[bookmark] 🔧 Building final bookmarks list...') const allBookmarks = dedupeBookmarksById([