mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix: hold gif thumbnails until first frame is ready
Distinguish GIF frame loading from GIF frame failure in useFetchGifFirstFrame(), so thread and catalog thumbnails no longer render animated GIFs before the still frame arrives. Keep the existing animated fallback when the first-frame fetch actually fails.
This commit is contained in:
@@ -39,11 +39,11 @@ export const LinkTypePreviewer = ({ link }: { link: string }) => {
|
||||
const { t } = useTranslation();
|
||||
const mediaInfo = getLinkMediaInfo(link);
|
||||
let type = mediaInfo?.type;
|
||||
const gifFrameUrl = useFetchGifFirstFrame(type === 'gif' ? mediaInfo?.url : undefined);
|
||||
const { status: gifFrameStatus } = useFetchGifFirstFrame(type === 'gif' ? mediaInfo?.url : undefined);
|
||||
|
||||
if (type === 'gif' && gifFrameUrl !== null) {
|
||||
if (type === 'gif' && gifFrameStatus === 'ready') {
|
||||
type = t('animated_gif');
|
||||
} else if (type === 'gif' && gifFrameUrl === null) {
|
||||
} else if (type === 'gif') {
|
||||
type = t('gif');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user