Skip to content

Commit 5d30e7a

Browse files
authored
fix: Prevent duplicate page loads on rapid keyboard shortcut use (fixes #198). (#200)
1 parent 0bea845 commit 5d30e7a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/contexts/StateContextProvider.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,12 @@ const StateContextProvider = ({children}: StateContextProviderProps) => {
455455
return;
456456
}
457457

458+
if (UI_STATE.READY !== uiStateRef.current) {
459+
console.warn("Skipping navigation: page load in progress.");
460+
461+
return;
462+
}
463+
458464
const cursor = getPageNumCursor(navAction, pageNumRef.current, numPagesRef.current);
459465
if (null === cursor) {
460466
console.error(`Error with nav action ${navAction.code}.`);

0 commit comments

Comments
 (0)