From 5cdc161d468e95fc50a10c322ac9eb4bb3cb80c2 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Tue, 16 Jun 2026 17:57:43 +0200 Subject: [PATCH] Fix infinite scroll previous chapter load with disabled transition page There is no guarantee that the scroll position is exactly 0 --- .../infinite-scroll/useReaderInfiniteScrollUpdateChapter.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/features/reader/infinite-scroll/useReaderInfiniteScrollUpdateChapter.ts b/src/features/reader/infinite-scroll/useReaderInfiniteScrollUpdateChapter.ts index b6f23e48..6df9beb8 100644 --- a/src/features/reader/infinite-scroll/useReaderInfiniteScrollUpdateChapter.ts +++ b/src/features/reader/infinite-scroll/useReaderInfiniteScrollUpdateChapter.ts @@ -271,15 +271,15 @@ export const useReaderInfiniteScrollUpdateChapter = ( } const onScroll = () => { - const THRESHOLD = 2; + const THRESHOLD = 1; - const isAtStartX = scrollElement.scrollLeft === 0; + const isAtStartX = Math.abs(scrollElement.scrollLeft) <= THRESHOLD; const distanceEndX = Math.abs( Math.abs(scrollElement.scrollLeft) - (scrollElement.scrollWidth - scrollElement.clientWidth), ); const isAtEndX = distanceEndX >= 0 && distanceEndX <= THRESHOLD; - const isAtStartY = scrollElement.scrollTop === 0; + const isAtStartY = scrollElement.scrollTop <= THRESHOLD; const distanceStartY = Math.abs( Math.abs(scrollElement.scrollTop) - (scrollElement.scrollHeight - scrollElement.clientHeight), );