Skip to content

Commit

Permalink
fix: loader timeouts instead of intervals
Browse files Browse the repository at this point in the history
  • Loading branch information
chambaz committed Dec 26, 2024
1 parent 5ea1b90 commit 572524e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ export function Loader({ label = "Loading...", className, iconSize = 32, duratio
const [isVisible, setIsVisible] = React.useState(true);

React.useEffect(() => {
const interval = setInterval(
const timeout = setTimeout(
() => {
setIsVisible((prev) => !prev);
},
isVisible ? duration : 1500
);

return () => clearInterval(interval);
return () => clearTimeout(timeout);
}, [isVisible, duration]);

const containerVariants: Variants = {
Expand Down

0 comments on commit 572524e

Please sign in to comment.