diff --git a/app/src/hooks/useChapterData.ts b/app/src/hooks/useChapterData.ts index 5ab04ce5..3882bd0e 100644 --- a/app/src/hooks/useChapterData.ts +++ b/app/src/hooks/useChapterData.ts @@ -45,6 +45,7 @@ export function useChapterData(bookId: string | null, chapterNum: number): Chapt if (!bookId) { // No book to load: clear the initial loading flag so consumers can // render a not-found/empty state instead of an indefinite skeleton. + // eslint-disable-next-line react-hooks/set-state-in-effect setIsLoading(false); return; } diff --git a/app/src/hooks/useDifficultPassages.ts b/app/src/hooks/useDifficultPassages.ts index bc57f000..9b1f5106 100644 --- a/app/src/hooks/useDifficultPassages.ts +++ b/app/src/hooks/useDifficultPassages.ts @@ -289,7 +289,10 @@ export function useDifficultPassage(passageId: string | undefined): DifficultPas useEffect(() => { // eslint-disable-next-line react-hooks/set-state-in-effect loadData(); - // Invalidate any in-flight load on unmount / passageId change. + // Invalidate any in-flight load on unmount / passageId change. We + // intentionally mutate the live ref here (not a copied value) so a load + // still in flight sees the bumped generation and drops its result. + // eslint-disable-next-line react-hooks/exhaustive-deps return () => { genRef.current++; }; }, [loadData]); diff --git a/app/src/services/connectivity.ts b/app/src/services/connectivity.ts index 21a385fe..5bafaf1c 100644 --- a/app/src/services/connectivity.ts +++ b/app/src/services/connectivity.ts @@ -16,7 +16,6 @@ type Listener = (connected: boolean) => void; let _connected = true; const _listeners = new Set(); let _started = false; -let _polling = false; let _pollTimer: ReturnType | null = null; let _netinfoUnsub: (() => void) | null = null; @@ -79,7 +78,6 @@ export function startMonitoring(): void { // Polling fallback: check reachability every 15 seconds. // Require two consecutive failures before marking offline so a single // slow/blocked fetch on startup doesn't flash the banner incorrectly. - _polling = true; let _consecutiveFails = 0; const check = async () => { try { @@ -116,7 +114,6 @@ export function stopMonitoring(): void { clearInterval(_pollTimer); _pollTimer = null; } - _polling = false; _started = false; _listeners.clear(); }