debug: add logging to bookmark grouping to diagnose missing bookmarks

Added console logs to groupIndividualBookmarks to see:
- Total items being grouped
- Count per group (nip51Public, nip51Private, amethystPublic, amethystPrivate, standaloneWeb)
- Sample of first 3 items with their sourceKind and isPrivate properties

This will help diagnose why 532 bookmarks are emitted but not appearing in sidebar.
This commit is contained in:
Gigi
2025-10-18 00:16:34 +02:00
parent 6ea0fd292c
commit 90c79e34eb

View File

@@ -93,6 +93,8 @@ export const sortIndividualBookmarks = (items: IndividualBookmark[]) => {
export function groupIndividualBookmarks(items: IndividualBookmark[]) {
const sorted = sortIndividualBookmarks(items)
console.log('[bookmark] 🗂️ Grouping', sorted.length, 'items')
// 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)
@@ -100,6 +102,23 @@ export function groupIndividualBookmarks(items: IndividualBookmark[]) {
const amethystPrivate = sorted.filter(i => i.sourceKind === 30001 && i.isPrivate)
const standaloneWeb = sorted.filter(i => i.sourceKind === 39701)
console.log('[bookmark] 🗂️ Groups:', {
nip51Public: nip51Public.length,
nip51Private: nip51Private.length,
amethystPublic: amethystPublic.length,
amethystPrivate: amethystPrivate.length,
standaloneWeb: standaloneWeb.length
})
// Debug: sample first few items to see their properties
if (sorted.length > 0) {
console.log('[bookmark] 🗂️ Sample items:', sorted.slice(0, 3).map(i => ({
sourceKind: i.sourceKind,
isPrivate: i.isPrivate,
id: i.id.slice(0, 16)
})))
}
return {
nip51Public,
nip51Private,