From 3991bfeeb2cae825da5fc916f4f05cd100069729 Mon Sep 17 00:00:00 2001 From: Gigi Date: Sun, 19 Oct 2025 23:54:44 +0200 Subject: [PATCH] fix: move lastLoadedPubkey assignment to end of start() method The bug: start() was setting lastLoadedPubkey at the beginning, so if start() got called twice (which it was), the second call would see isLoadedFor(pubkey) return true and skip the entire loading process, including fetching mark-as-read reactions. Fix: Only set lastLoadedPubkey AFTER all fetching is complete. This ensures that concurrent start() calls don't skip the loading. This allows kind:7 and kind:17 mark-as-read reactions to be fetched and tracked properly. --- src/services/readingProgressController.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/readingProgressController.ts b/src/services/readingProgressController.ts index db4fb32d..e5859139 100644 --- a/src/services/readingProgressController.ts +++ b/src/services/readingProgressController.ts @@ -186,7 +186,6 @@ class ReadingProgressController { } this.setLoading(true) - this.lastLoadedPubkey = pubkey try { // Seed from local cache immediately (survives refresh/flight mode) @@ -333,6 +332,9 @@ class ReadingProgressController { console.log('[readingProgress] Final markedAsReadIds:', Array.from(this.markedAsReadIds)) } } + + // Mark as loaded AFTER everything is fetched + this.lastLoadedPubkey = pubkey } catch (err) { console.error('📊 [ReadingProgress] Failed to load:', err) } finally {