mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
perf(media): restrict gif frame extraction to gif media types
This commit is contained in:
@@ -391,7 +391,7 @@ const CommentMedia = ({
|
|||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
const { thumbnailHeight, thumbnailWidth, url } = commentMediaInfo || {};
|
const { thumbnailHeight, thumbnailWidth, url } = commentMediaInfo || {};
|
||||||
let type = commentMediaInfo?.type;
|
let type = commentMediaInfo?.type;
|
||||||
const gifFrameUrl = useFetchGifFirstFrame(url);
|
const gifFrameUrl = useFetchGifFirstFrame(type === 'gif' ? url : undefined);
|
||||||
|
|
||||||
if (type === 'gif' && gifFrameUrl) {
|
if (type === 'gif' && gifFrameUrl) {
|
||||||
type = 'animated gif';
|
type = 'animated gif';
|
||||||
|
|||||||
@@ -543,7 +543,7 @@ const PostMedia = ({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { url } = commentMediaInfo || {};
|
const { url } = commentMediaInfo || {};
|
||||||
let type = commentMediaInfo?.type;
|
let type = commentMediaInfo?.type;
|
||||||
const gifFrameUrl = useFetchGifFirstFrame(url);
|
const gifFrameUrl = useFetchGifFirstFrame(type === 'gif' ? url : undefined);
|
||||||
const directories = useDirectories();
|
const directories = useDirectories();
|
||||||
|
|
||||||
if (type === 'gif' && gifFrameUrl !== null) {
|
if (type === 'gif' && gifFrameUrl !== null) {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export const LinkTypePreviewer = ({ link }: { link: string }) => {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const mediaInfo = getLinkMediaInfo(link);
|
const mediaInfo = getLinkMediaInfo(link);
|
||||||
let type = mediaInfo?.type;
|
let type = mediaInfo?.type;
|
||||||
const gifFrameUrl = useFetchGifFirstFrame(mediaInfo?.url);
|
const gifFrameUrl = useFetchGifFirstFrame(type === 'gif' ? mediaInfo?.url : undefined);
|
||||||
|
|
||||||
if (type === 'gif' && gifFrameUrl !== null) {
|
if (type === 'gif' && gifFrameUrl !== null) {
|
||||||
type = t('animated_gif');
|
type = t('animated_gif');
|
||||||
|
|||||||
Reference in New Issue
Block a user