Skip to content

UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.

fix: update number ticker typescript issue

Dillion Vermac9a0e795d4af
diff --git a/registry/magicui/number-ticker.tsx b/registry/magicui/number-ticker.tsx
index a70be7b3..2836fdff 100644
--- a/registry/magicui/number-ticker.tsx
+++ b/registry/magicui/number-ticker.tsx
@@ -29,10 +29,12 @@ export function NumberTicker({
const isInView = useInView(ref, { once: true, margin: "0px" });
useEffect(() => {
- isInView &&
- setTimeout(() => {
+ if (isInView) {
+ const timer = setTimeout(() => {
motionValue.set(direction === "down" ? 0 : value);
}, delay * 1000);
+ return () => clearTimeout(timer);
+ }
}, [motionValue, isInView, delay, value, direction]);
useEffect(