From cecff6b8d5e3869c01147b0ed85e2850d61b13bb Mon Sep 17 00:00:00 2001 From: Gigi Date: Mon, 20 Oct 2025 14:45:30 +0200 Subject: [PATCH] fix: filter out bookmark list events from individual bookmarks display - Bookmark list events (kind:10003, 30003, 30001) are containers, not content - Add filter in hydrateItems to exclude these kinds after hydration - Add debug logging to track which items are being filtered - Prevents bookmark list events from showing as individual bookmarks in UI --- src/services/bookmarkHelpers.ts | 51 +++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/src/services/bookmarkHelpers.ts b/src/services/bookmarkHelpers.ts index dc5654a8..475417f0 100644 --- a/src/services/bookmarkHelpers.ts +++ b/src/services/bookmarkHelpers.ts @@ -175,29 +175,36 @@ export function hydrateItems( items: IndividualBookmark[], idToEvent: Map ): IndividualBookmark[] { - return items.map(item => { - const ev = idToEvent.get(item.id) - if (!ev) return item - - // For long-form articles (kind:30023), use the article title as content - let content = ev.content || item.content || '' - if (ev.kind === 30023) { - const articleTitle = getArticleTitle(ev) - if (articleTitle) { - content = articleTitle + return items + .map(item => { + const ev = idToEvent.get(item.id) + if (!ev) return item + + // For long-form articles (kind:30023), use the article title as content + let content = ev.content || item.content || '' + if (ev.kind === 30023) { + const articleTitle = getArticleTitle(ev) + if (articleTitle) { + content = articleTitle + } } - } - - return { - ...item, - pubkey: ev.pubkey || item.pubkey, - content, - created_at: ev.created_at || item.created_at, - kind: ev.kind || item.kind, - tags: ev.tags || item.tags, - parsedContent: ev.content ? (getParsedContent(content) as ParsedContent) : item.parsedContent - } - }) + + return { + ...item, + pubkey: ev.pubkey || item.pubkey, + content, + created_at: ev.created_at || item.created_at, + kind: ev.kind || item.kind, + tags: ev.tags || item.tags, + parsedContent: ev.content ? (getParsedContent(content) as ParsedContent) : item.parsedContent + } + }) + .filter(item => { + // Filter out bookmark list events (they're containers, not content) + const isBookmarkListEvent = item.kind === 10003 || item.kind === 30003 || item.kind === 30001 + console.log('[BOOKMARK_TS] After hydration - id:', item.id, 'kind:', item.kind, 'isBookmarkListEvent:', isBookmarkListEvent, 'content:', item.content?.substring(0, 50)) + return !isBookmarkListEvent + }) } // Note: event decryption/collection lives in `bookmarkProcessing.ts`