Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/src/hooks/useChapterData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
5 changes: 4 additions & 1 deletion app/src/hooks/useDifficultPassages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down
3 changes: 0 additions & 3 deletions app/src/services/connectivity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ type Listener = (connected: boolean) => void;
let _connected = true;
const _listeners = new Set<Listener>();
let _started = false;
let _polling = false;
let _pollTimer: ReturnType<typeof setInterval> | null = null;
let _netinfoUnsub: (() => void) | null = null;

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -116,7 +114,6 @@ export function stopMonitoring(): void {
clearInterval(_pollTimer);
_pollTimer = null;
}
_polling = false;
_started = false;
_listeners.clear();
}
Loading