fix: only request hydration for items without content

- Only fetch events for bookmarks that don't have content yet
- Bookmarks with existing content (web bookmarks, etc.) don't need fetching
- This reduces unnecessary fetches and focuses on what's needed
- Should show much better content in bookmarks list
This commit is contained in:
Gigi
2025-10-22 01:01:23 +02:00
parent 934768ebf2
commit 347e23ff6f

View File

@@ -261,19 +261,21 @@ class BookmarkController {
})
const allItems = [...publicItemsAll, ...privateItemsAll]
// Dedupe BEFORE hydration to avoid requesting duplicate events
const deduped = dedupeBookmarksById(allItems)
// Separate hex IDs from coordinates
// Separate hex IDs from coordinates for fetching
const noteIds: string[] = []
const coordinates: string[] = []
// Request hydration for all items that don't have content yet
deduped.forEach(i => {
if (/^[0-9a-f]{64}$/i.test(i.id)) {
noteIds.push(i.id)
} else if (i.id.includes(':')) {
coordinates.push(i.id)
// If item has no content, we need to fetch it
if (!i.content || i.content.length === 0) {
if (/^[0-9a-f]{64}$/i.test(i.id)) {
noteIds.push(i.id)
} else if (i.id.includes(':')) {
coordinates.push(i.id)
}
}
})