Skip to content

Commit

Permalink
πŸ› improve loading bar UX
Browse files Browse the repository at this point in the history
  • Loading branch information
MatissJanis committed May 8, 2022
1 parent b9c3e0d commit 248c9b6
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/hooks/use-progress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 248c9b6

Please sign in to comment.