diff --git a/components/Misc/S3Util.tsx b/components/Misc/S3Util.tsx index a3d35a1..0040d08 100644 --- a/components/Misc/S3Util.tsx +++ b/components/Misc/S3Util.tsx @@ -13,11 +13,15 @@ export function S3Image({ S3key, style }: S3ImageProps) { const [source, setSource] = useState(PLACEHOLDER_IMG_URL); useEffect(() => { + let downloading = true; checkCache(S3key).then((response) => { - if (response) { + if (response && downloading) { setSource({ uri: response }); } }); + return () => { + downloading = false; + }; }, [S3key]); return ( @@ -29,9 +33,13 @@ export function S3ImageBackground({ S3key, style }: S3ImageProps) { const [source, setSource] = useState(PLACEHOLDER_BANNER); useEffect(() => { + let downloading = true; checkCache(S3key).then((response) => { - if (response) setSource({ uri: response }); + if (response && downloading) setSource({ uri: response }); }); + return () => { + downloading = false; + }; }, [S3key]); return (