From d99d950585ecb0ccc125d11400f08594409cad9c Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Thu, 5 Feb 2026 02:05:21 +0100 Subject: [PATCH] Fix refreshing thumbnail during manga refresh When using blobs (e.g. due to authentication), manually refreshing caused the thumbnail to break on the manga page. This was caused because the image got cleaned up, but did not get reloaded again because it was considered to be already loaded. Regression 3a27461598b20c407bbcde7c752b88a339d2294e --- src/base/components/SpinnerImage.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/base/components/SpinnerImage.tsx b/src/base/components/SpinnerImage.tsx index 3a8f69f4..28f75cf1 100644 --- a/src/base/components/SpinnerImage.tsx +++ b/src/base/components/SpinnerImage.tsx @@ -16,6 +16,7 @@ import RefreshIcon from '@mui/icons-material/Refresh'; import ImageIcon from '@mui/icons-material/Image'; import { SxProps, Theme } from '@mui/material/styles'; import { useLingui } from '@lingui/react/macro'; +import { usePrevious } from '@mantine/hooks'; import { ImageRequest, requestManager } from '@/lib/requests/RequestManager.ts'; import { Priority } from '@/lib/Queue.ts'; import { applyStyles } from '@/base/utils/ApplyStyles.ts'; @@ -71,6 +72,8 @@ 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(); @@ -96,7 +99,10 @@ export const SpinnerImage = ({ ref, ...props }: SpinnerImageProps) => { ); useEffect(() => { - if (showMissingImageIcon || !shouldLoad || !!imageSourceUrl) { + const didSrcChange = previousSrc !== src; + const isLoadedAndSrcUnchanged = !!imageSourceUrl && !didSrcChange; + + if (showMissingImageIcon || !shouldLoad || isLoadedAndSrcUnchanged) { return () => {}; }