mirror of
https://github.com/dergigi/boris.git
synced 2026-01-07 08:54:25 +01:00
debug: improve timeline subscription and add more logs
- Capture events from timeline before unsubscribing - Add log to show when timeline emits - Add log after unsubscribe to show what we got - This will help debug why processEvents isn't being called
This commit is contained in:
@@ -135,17 +135,22 @@ class ReadingProgressController {
|
||||
authors: [pubkey]
|
||||
})
|
||||
|
||||
// Subscribe to get initial events synchronously
|
||||
const subscription = timeline.subscribe((localEvents) => {
|
||||
console.log('📊 [ReadingProgress] Found', localEvents.length, 'events in local store')
|
||||
if (localEvents.length > 0) {
|
||||
this.processEvents(localEvents)
|
||||
}
|
||||
// Get the latest value from timeline - it should emit immediately
|
||||
let localEvents: any[] = []
|
||||
const subscription = timeline.subscribe((events) => {
|
||||
localEvents = events
|
||||
console.log('📊 [ReadingProgress] Timeline emitted', events.length, 'events')
|
||||
})
|
||||
|
||||
// Unsubscribe immediately after getting initial value
|
||||
// Unsubscribe after getting value
|
||||
subscription.unsubscribe()
|
||||
|
||||
console.log('📊 [ReadingProgress] Processing', localEvents.length, 'events from local store')
|
||||
|
||||
if (localEvents.length > 0) {
|
||||
this.processEvents(localEvents)
|
||||
}
|
||||
|
||||
// 2. Then fetch from relays (incremental or full) to augment local data
|
||||
const lastSynced = force ? null : this.getLastSyncedAt(pubkey)
|
||||
const filter: any = {
|
||||
|
||||
Reference in New Issue
Block a user