From 4476e9d087b47dd041d056b4c5fa683c9529ea4e Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Thu, 29 Jun 2023 18:55:17 +0800 Subject: [PATCH] Only run this when showing original --- src/components/media.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/media.jsx b/src/components/media.jsx index 1d552bf8..3462ecfe 100644 --- a/src/components/media.jsx +++ b/src/components/media.jsx @@ -122,6 +122,7 @@ function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) { useLayoutEffect(() => { if (!isSafari) return; + if (!showOriginal) return; (async () => { try { await fetch(mediaURL, { mode: 'no-cors' }); @@ -185,6 +186,7 @@ function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) { }} onLoad={(e) => { e.target.closest('.media-image').style.backgroundImage = ''; + e.target.dataset.loaded = true; }} onError={(e) => { const { src } = e.target;