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.
This commit is contained in:
Gigi
2025-10-19 23:54:44 +02:00
parent e8c35c8914
commit 3991bfeeb2

View File

@@ -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 {