diff --git a/src/components/post/thumbnail/thumbnail.tsx b/src/components/post/thumbnail/thumbnail.tsx index 2878a232..62532cbd 100644 --- a/src/components/post/thumbnail/thumbnail.tsx +++ b/src/components/post/thumbnail/thumbnail.tsx @@ -44,8 +44,8 @@ const Thumbnail = ({ cid, commentMediaInfo, expanded = false, isReply = false, l mediaComponent = ; } else if (commentMediaInfo?.type === 'iframe') { mediaComponent = iframeThumbnail ? : null; - } else if (commentMediaInfo?.type === 'gif' && gifFrameUrl) { - mediaComponent = ; + } else if (commentMediaInfo?.type === 'gif') { + mediaComponent = ; } return ( diff --git a/src/hooks/use-fetch-gif-first-frame.ts b/src/hooks/use-fetch-gif-first-frame.ts index a7f21054..08cb91c8 100644 --- a/src/hooks/use-fetch-gif-first-frame.ts +++ b/src/hooks/use-fetch-gif-first-frame.ts @@ -75,8 +75,13 @@ const useFetchGifFirstFrame = (url: string | undefined) => { try { const cachedFrame = await getCachedGifFrame(url); if (cachedFrame) { - if (isActive) setFrameUrl(cachedFrame); - return; + try { + const response = await fetch(cachedFrame); + if (response.ok) { + if (isActive) setFrameUrl(cachedFrame); + return; + } + } catch {} } const blob = typeof url === 'string' ? await parseGif(await fetchImage(url)) : await parseGif(await readImage(url as File));