Break the tasks

This commit is contained in:
Lim Chee Aun 2024-05-28 22:22:14 +08:00
parent b6a64b66c7
commit 563b06e680
2 changed files with 3 additions and 3 deletions

View file

@ -63,7 +63,7 @@ function Avatar({ url, size, alt = '', squircle, ...props }) {
if (avatarRef.current) avatarRef.current.dataset.loaded = true; if (avatarRef.current) avatarRef.current.dataset.loaded = true;
if (alphaCache[url] !== undefined) return; if (alphaCache[url] !== undefined) return;
if (isMissing) return; if (isMissing) return;
queueMicrotask(() => { setTimeout(() => {
try { try {
// Check if image has alpha channel // Check if image has alpha channel
const { width, height } = e.target; const { width, height } = e.target;
@ -88,7 +88,7 @@ function Avatar({ url, size, alt = '', squircle, ...props }) {
// Silent fail // Silent fail
alphaCache[url] = false; alphaCache[url] = false;
} }
}); }, 1);
}} }}
/> />
)} )}

View file

@ -34,7 +34,7 @@ export default function Modals() {
const location = useLocation(); const location = useLocation();
useEffect(() => { useEffect(() => {
queueMicrotask(preload); setTimeout(preload, 1);
}, []); }, []);
return ( return (