fix(feed post): gif thumbnail could break persistently

This commit is contained in:
Tom (plebeius.eth)
2024-12-12 16:38:04 +01:00
parent 77bee78164
commit e3cf5076be
+5
View File
@@ -75,9 +75,14 @@ const useFetchGifFirstFrame = (url: string | undefined) => {
try { try {
const cachedFrame = await getCachedGifFrame(url); const cachedFrame = await getCachedGifFrame(url);
if (cachedFrame) { if (cachedFrame) {
try {
const response = await fetch(cachedFrame);
if (response.ok) {
if (isActive) setFrameUrl(cachedFrame); if (isActive) setFrameUrl(cachedFrame);
return; return;
} }
} catch {}
}
const blob = typeof url === 'string' ? await parseGif(await fetchImage(url)) : await parseGif(await readImage(url as File)); const blob = typeof url === 'string' ? await parseGif(await fetchImage(url)) : await parseGif(await readImage(url as File));
const objectUrl = URL.createObjectURL(blob); const objectUrl = URL.createObjectURL(blob);