mirror of
https://github.com/plebbit/seedit.git
synced 2026-02-07 12:31:06 -05:00
fix(feed post): gif thumbnail could break persistently
This commit is contained in:
@@ -44,8 +44,8 @@ const Thumbnail = ({ cid, commentMediaInfo, expanded = false, isReply = false, l
|
||||
mediaComponent = <img src={commentMediaInfo.thumbnail} alt='' />;
|
||||
} else if (commentMediaInfo?.type === 'iframe') {
|
||||
mediaComponent = iframeThumbnail ? <img src={iframeThumbnail} alt='' /> : null;
|
||||
} else if (commentMediaInfo?.type === 'gif' && gifFrameUrl) {
|
||||
mediaComponent = <img src={gifFrameUrl} alt='' />;
|
||||
} else if (commentMediaInfo?.type === 'gif') {
|
||||
mediaComponent = <img src={gifFrameUrl || commentMediaInfo.url} alt='' />;
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user