From e3babfed312086d1b690e9499cb215a572482f4c Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sat, 2 May 2026 15:24:38 +0200 Subject: [PATCH] Fix reader page retry button in continuous reading modes In these modes the reader does not load leading pages to prevent the resulting layout shift on load. This behavior prevented the retry button functionality. Due to the way loading/failed pages are rendered and how the current page is detected, it's possible that the retry button for a leading page is visible, which resulted in showing a retry button without any functionality. fixes #1088 --- CHANGELOG.md | 3 ++- src/base/components/SpinnerImage.tsx | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f3ada13..deccc7b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,9 +38,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - (**Reader**) Fix "auto webtoon mode" detection for manga source languages other than english and the current selected language - (**Reader**) Fix the reader transition page previous chapter scanlator name showing the chapter name instead of the scanlator name - (**Reader**) Fix opening the previous/next chapter in the continuous horizontal mode with inverted reading direction -- (**Reader**) Fix scroll preservation in continuous horizontal mode with righ to left reading direction +- (**Reader**) Fix scroll preservation in continuous horizontal mode with right to left reading direction - (**Reader**) Fix mobile progress bar previous/next button not being clickable in single page chapters - (**Reader**) Fix scroll position jumping on chapter resume in the continuous horizontal mode +- (**Reader**) Fix page load retry button in continuous reading modes - (**Manga**) Fix dynamic manga page color theme not getting reset after leaving the manga page ## [20251230.01] (r2937) - 2025-12-30 diff --git a/src/base/components/SpinnerImage.tsx b/src/base/components/SpinnerImage.tsx index 74a1bc93..bf950145 100644 --- a/src/base/components/SpinnerImage.tsx +++ b/src/base/components/SpinnerImage.tsx @@ -75,14 +75,16 @@ export const SpinnerImage = ({ ref, ...props }: SpinnerImageProps) => { const showMissingImageIcon = !src.length; - const previousSrc = usePrevious(src); - const [imageSourceUrl, setImageSourceUrl] = useState(); const [imgLoadRetryKey, setImgLoadRetryKey] = useState(0); const [isLoading, setIsLoading] = useState(); const [hasError, setHasError] = useState(false); const [isVisible, setIsVisible] = useState(false); + const previousSrc = usePrevious(src); + const previousImgLoadRetryKey = usePrevious(imgLoadRetryKey); + const previousRetryKeyPrefix = usePrevious(retryKeyPrefix); + const updateImageState = (loading: boolean, error: boolean = false, aborted: boolean = false) => { setIsLoading(loading); setHasError(error); @@ -105,7 +107,15 @@ export const SpinnerImage = ({ ref, ...props }: SpinnerImageProps) => { const didSrcChange = previousSrc !== src; const isLoadedAndSrcUnchanged = !!imageSourceUrl && !didSrcChange; - if (showMissingImageIcon || !shouldLoad || isLoadedAndSrcUnchanged) { + const isLocalRetry = + hasError && previousImgLoadRetryKey !== undefined && previousImgLoadRetryKey !== imgLoadRetryKey; + const isGlobalRetry = + hasError && previousRetryKeyPrefix !== undefined && previousRetryKeyPrefix !== retryKeyPrefix; + const isRetry = isLocalRetry || isGlobalRetry; + + const finalShouldLoad = shouldLoad || isRetry; + + if (showMissingImageIcon || !finalShouldLoad || isLoadedAndSrcUnchanged) { return () => {}; }