Only run this when showing original
This commit is contained in:
parent
c609ba0194
commit
4476e9d087
1 changed files with 2 additions and 0 deletions
|
@ -122,6 +122,7 @@ function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) {
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (!isSafari) return;
|
if (!isSafari) return;
|
||||||
|
if (!showOriginal) return;
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
await fetch(mediaURL, { mode: 'no-cors' });
|
await fetch(mediaURL, { mode: 'no-cors' });
|
||||||
|
@ -185,6 +186,7 @@ function Media({ media, to, showOriginal, autoAnimate, onClick = () => {} }) {
|
||||||
}}
|
}}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
e.target.closest('.media-image').style.backgroundImage = '';
|
e.target.closest('.media-image').style.backgroundImage = '';
|
||||||
|
e.target.dataset.loaded = true;
|
||||||
}}
|
}}
|
||||||
onError={(e) => {
|
onError={(e) => {
|
||||||
const { src } = e.target;
|
const { src } = e.target;
|
||||||
|
|
Loading…
Add table
Reference in a new issue