From 563b06e680f811d8e920c3753e7d998997c9017a Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Tue, 28 May 2024 22:22:14 +0800 Subject: [PATCH] Break the tasks --- src/components/avatar.jsx | 4 ++-- src/components/modals.jsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/avatar.jsx b/src/components/avatar.jsx index f0afddfa..ab6f54a8 100644 --- a/src/components/avatar.jsx +++ b/src/components/avatar.jsx @@ -63,7 +63,7 @@ function Avatar({ url, size, alt = '', squircle, ...props }) { if (avatarRef.current) avatarRef.current.dataset.loaded = true; if (alphaCache[url] !== undefined) return; if (isMissing) return; - queueMicrotask(() => { + setTimeout(() => { try { // Check if image has alpha channel const { width, height } = e.target; @@ -88,7 +88,7 @@ function Avatar({ url, size, alt = '', squircle, ...props }) { // Silent fail alphaCache[url] = false; } - }); + }, 1); }} /> )} diff --git a/src/components/modals.jsx b/src/components/modals.jsx index 4a855333..79467ed9 100644 --- a/src/components/modals.jsx +++ b/src/components/modals.jsx @@ -34,7 +34,7 @@ export default function Modals() { const location = useLocation(); useEffect(() => { - queueMicrotask(preload); + setTimeout(preload, 1); }, []); return (