diff --git a/src/hooks/useReadingPosition.ts b/src/hooks/useReadingPosition.ts index bb635089..00531ff0 100644 --- a/src/hooks/useReadingPosition.ts +++ b/src/hooks/useReadingPosition.ts @@ -148,6 +148,8 @@ export const useReadingPosition = ({ clearTimeout(saveTimerRef.current) } } + // position is intentionally not in deps - it's computed from scroll and would cause infinite re-renders + // eslint-disable-next-line react-hooks/exhaustive-deps }, [enabled, onPositionChange, onReadingComplete, readingCompleteThreshold, scheduleSave]) // Reset reading complete state when enabled changes diff --git a/src/services/readingProgressController.ts b/src/services/readingProgressController.ts index c1d0043f..6fec89f8 100644 --- a/src/services/readingProgressController.ts +++ b/src/services/readingProgressController.ts @@ -1,5 +1,6 @@ import { RelayPool } from 'applesauce-relay' import { IEventStore } from 'applesauce-core' +import { Filter, NostrEvent } from 'nostr-tools' import { queryEvents } from './dataFetch' import { KINDS } from '../config/kinds' import { RELAYS } from '../config/relays' @@ -134,7 +135,7 @@ class ReadingProgressController { const needsFullSync = force || this.currentProgressMap.size === 0 const lastSynced = needsFullSync ? null : this.getLastSyncedAt(pubkey) - const filter: any = { + const filter: Filter = { kinds: [KINDS.ReadingProgress], authors: [pubkey] } @@ -179,7 +180,7 @@ class ReadingProgressController { /** * Process events and update progress map */ - private processEvents(events: any[]): void { + private processEvents(events: NostrEvent[]): void { console.log('[progress] 🔄 Processing', events.length, 'events') const readsMap = new Map()