From 591a41149f48d28f33b127c15399d428327df048 Mon Sep 17 00:00:00 2001 From: Julien Froidefond Date: Fri, 7 Mar 2025 07:55:37 +0100 Subject: [PATCH] fix: reader for first and last page should not continue on next and first pages --- src/components/reader/hooks/usePageNavigation.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/reader/hooks/usePageNavigation.ts b/src/components/reader/hooks/usePageNavigation.ts index 5ed56de..465b31c 100644 --- a/src/components/reader/hooks/usePageNavigation.ts +++ b/src/components/reader/hooks/usePageNavigation.ts @@ -98,6 +98,7 @@ export const usePageNavigation = ({ ); const handlePreviousPage = useCallback(() => { + if (currentPage === 1) return; if (isDoublePage && shouldShowDoublePage(currentPage - 2)) { navigateToPage(Math.max(1, currentPage - 2)); } else { @@ -106,6 +107,7 @@ export const usePageNavigation = ({ }, [currentPage, isDoublePage, navigateToPage, shouldShowDoublePage]); const handleNextPage = useCallback(() => { + if (currentPage === pages.length) return; if (isDoublePage && shouldShowDoublePage(currentPage)) { navigateToPage(Math.min(pages.length, currentPage + 2)); } else {