refactor: simplify reads loading - don't require bookmarks

Reads don't actually need bookmarks to load. Reading progress (kind:39802)
is independent and stands on its own. Bookmarks are just optional enrichment.

Changed:
- readsController.start() no longer takes bookmarks parameter
- Pass empty array to fetchAllReads instead
- Load reads immediately in App.tsx like highlights/writings
- No more circular dependency on bookmarks loading first

This is simpler and loads reading progress faster.
This commit is contained in:
Gigi
2025-10-19 23:26:00 +02:00
parent ab5225de50
commit 0f1dfa445a
2 changed files with 3 additions and 4 deletions

View File

@@ -117,7 +117,7 @@ function AppRoutes({
// Load reads (controller manages its own state)
if (pubkey && eventStore && !readsController.isLoadedFor(pubkey)) {
readsController.start({ relayPool, eventStore, pubkey, bookmarks })
readsController.start({ relayPool, eventStore, pubkey })
}
// Start centralized nostrverse highlights controller (non-blocking)

View File

@@ -109,10 +109,9 @@ class ReadsController {
relayPool: RelayPool
eventStore: IEventStore
pubkey: string
bookmarks: Bookmark[]
force?: boolean
}): Promise<void> {
const { relayPool, eventStore, pubkey, bookmarks, force = false } = params
const { relayPool, eventStore, pubkey, force = false } = params
const startGeneration = this.generation
// Skip if already loaded for this pubkey (unless forced)
@@ -129,7 +128,7 @@ class ReadsController {
// Stream items as they're fetched
// This updates the UI progressively as reading progress, marks as read, bookmarks arrive
await fetchAllReads(relayPool, pubkey, bookmarks, (item) => {
await fetchAllReads(relayPool, pubkey, [], (item) => {
// Check if this generation is still active (user didn't log out)
if (startGeneration !== this.generation) return