From 248c9b674b522c02955db7ea95a8ae7d5ccc2c07 Mon Sep 17 00:00:00 2001 From: Matiss Janis Aboltins Date: Sun, 8 May 2022 22:56:51 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=20=20improve=20loading=20bar=20?= =?UTF-8?q?UX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/use-progress.tsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/hooks/use-progress.tsx b/src/hooks/use-progress.tsx index fea1577..95c42f4 100644 --- a/src/hooks/use-progress.tsx +++ b/src/hooks/use-progress.tsx @@ -8,18 +8,13 @@ export default function useProgress( useEffect(() => { if (progress < maxProgress) { - setTimeout(() => setProgress((state) => state + 1), 800); + setTimeout(() => setProgress((state) => state + 1), 1000); } }, [progress, maxProgress]); useEffect(() => { - setProgress((state) => { - if (state > currentProgress) { - return state; - } - return currentProgress; - }); + setProgress(currentProgress); }, [currentProgress]); - return progress; + return currentProgress > progress ? currentProgress : progress; }