mirror of
https://github.com/dergigi/boris.git
synced 2025-12-26 19:14:52 +01:00
debug: add logging to diagnose bookmark grouping issue
Added console logs in groupIndividualBookmarks to show: - Distribution of sourceKind values across all bookmarks - Sample items with their sourceKind, isPrivate, setName, and id - Count of items in each group after filtering This will help identify why grouped view shows only ~40 bookmarks while flat view shows 500+.
This commit is contained in:
@@ -93,6 +93,23 @@ 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<number | undefined, number>()
|
||||
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)
|
||||
|
||||
// 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)
|
||||
@@ -101,6 +118,15 @@ export function groupIndividualBookmarks(items: IndividualBookmark[]) {
|
||||
const amethystPrivate = sorted.filter(i => i.sourceKind === 30001 && i.isPrivate && i.setName === 'bookmark')
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user