mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-24 16:58:47 +01:00
omg fix this infinite loop if image keeps erroring
This commit is contained in:
parent
a3015e75f0
commit
0467dc7c09
1 changed files with 4 additions and 2 deletions
|
@ -36,8 +36,10 @@ function Avatar({ url, size, alt = '', ...props }) {
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
crossOrigin={alphaCache[url] === undefined ? 'anonymous' : undefined}
|
crossOrigin={alphaCache[url] === undefined ? 'anonymous' : undefined}
|
||||||
onError={(e) => {
|
onError={(e) => {
|
||||||
e.target.crossOrigin = null;
|
if (e.target.crossOrigin) {
|
||||||
e.target.src = url;
|
e.target.crossOrigin = null;
|
||||||
|
e.target.src = url;
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
onLoad={(e) => {
|
onLoad={(e) => {
|
||||||
if (avatarRef.current) avatarRef.current.dataset.loaded = true;
|
if (avatarRef.current) avatarRef.current.dataset.loaded = true;
|
||||||
|
|
Loading…
Reference in a new issue