From 0f1dfa445a7272ff300b3cb4d5b8adbbe78483a7 Mon Sep 17 00:00:00 2001 From: Gigi Date: Sun, 19 Oct 2025 23:26:00 +0200 Subject: [PATCH] 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. --- src/App.tsx | 2 +- src/services/readsController.ts | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index f55d4f3d..af9ae277 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -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) diff --git a/src/services/readsController.ts b/src/services/readsController.ts index 0d45d179..aaaed1e8 100644 --- a/src/services/readsController.ts +++ b/src/services/readsController.ts @@ -109,10 +109,9 @@ class ReadsController { relayPool: RelayPool eventStore: IEventStore pubkey: string - bookmarks: Bookmark[] force?: boolean }): Promise { - 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