From 3b08cd5d2310cf1571e7736880fefdc0d58ead78 Mon Sep 17 00:00:00 2001 From: Gigi Date: Sat, 18 Oct 2025 00:44:54 +0200 Subject: [PATCH] fix: remove setName filter from Amethyst bookmark grouping Fixed issue where 489 kind:30001 bookmarks were not appearing in groups because they had setName: undefined instead of setName: 'bookmark'. Changes: - Removed setName === 'bookmark' requirement from amethystPublic/Private filters - Now all kind:30001 bookmarks are grouped correctly regardless of setName - Removed debug logging that was added to diagnose the issue Before: Only 40 bookmarks shown (26 NIP-51 + 7 standalone + 7 web) After: All 522 bookmarks shown (26 NIP-51 + 489 Amethyst + 7 web) --- src/utils/bookmarkUtils.tsx | 41 +++---------------------------------- 1 file changed, 3 insertions(+), 38 deletions(-) diff --git a/src/utils/bookmarkUtils.tsx b/src/utils/bookmarkUtils.tsx index 3ea41e53..dd09cfcf 100644 --- a/src/utils/bookmarkUtils.tsx +++ b/src/utils/bookmarkUtils.tsx @@ -93,49 +93,14 @@ export const sortIndividualBookmarks = (items: IndividualBookmark[]) => { export function groupIndividualBookmarks(items: IndividualBookmark[]) { const sorted = sortIndividualBookmarks(items) - // Debug: log what sourceKind values we're seeing - const sourceKindCounts = new Map() - sorted.forEach(i => { - const count = sourceKindCounts.get(i.sourceKind) || 0 - sourceKindCounts.set(i.sourceKind, count + 1) - }) - console.log('[bookmark] 📊 SourceKind distribution:', Object.fromEntries(sourceKindCounts)) - - // Sample a few items to see their properties - const samples = sorted.slice(0, 5).map(i => ({ - sourceKind: i.sourceKind, - isPrivate: i.isPrivate, - setName: i.setName, - id: i.id.slice(0, 20) - })) - console.log('[bookmark] 📊 Sample items:', samples) - - // Debug: Show setName distribution for kind:30001 - const kind30001Items = sorted.filter(i => i.sourceKind === 30001) - const setNameCounts = new Map() - kind30001Items.forEach(i => { - const count = setNameCounts.get(i.setName) || 0 - setNameCounts.set(i.setName, count + 1) - }) - console.log('[bookmark] 📊 kind:30001 setName distribution:', Object.fromEntries(setNameCounts)) - // Group by source list, not by content type const nip51Public = sorted.filter(i => i.sourceKind === 10003 && !i.isPrivate) const nip51Private = sorted.filter(i => i.sourceKind === 10003 && i.isPrivate) - // Amethyst bookmarks: kind:30001 with d-tag "bookmark" - const amethystPublic = sorted.filter(i => i.sourceKind === 30001 && !i.isPrivate && i.setName === 'bookmark') - const amethystPrivate = sorted.filter(i => i.sourceKind === 30001 && i.isPrivate && i.setName === 'bookmark') + // Amethyst bookmarks: kind:30001 (any d-tag or undefined) + const amethystPublic = sorted.filter(i => i.sourceKind === 30001 && !i.isPrivate) + const amethystPrivate = sorted.filter(i => i.sourceKind === 30001 && i.isPrivate) const standaloneWeb = sorted.filter(i => i.sourceKind === 39701) - console.log('[bookmark] 📊 After grouping:', { - nip51Public: nip51Public.length, - nip51Private: nip51Private.length, - amethystPublic: amethystPublic.length, - amethystPrivate: amethystPrivate.length, - standaloneWeb: standaloneWeb.length, - total: sorted.length - }) - return { nip51Public, nip51Private,