Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

account for edge case in counting numbers utility

Steven Teyf330f8e471ee
diff --git a/components/shared/counting-numbers.tsx b/components/shared/counting-numbers.tsx
index fa6c494713..97d452c32f 100644
--- a/components/shared/counting-numbers.tsx
+++ b/components/shared/counting-numbers.tsx
@@ -17,7 +17,10 @@ export default function CountingNumbers({
duration?: number;
}) {
const [number, setNumber] = useState(start);
- const increment = Math.floor(Math.abs(start - value) / (duration / interval));
+ const increment =
+ value < duration / interval
+ ? 1
+ : Math.floor(Math.abs(start - value) / (duration / interval));
const ref = useRef(null);
const isInView = useInView(ref);
diff --git a/pages/index.tsx b/pages/index.tsx
index 56c6130622..c45512849a 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -51,7 +51,7 @@ export async function getStaticProps() {
return {
props: {
- stars: stars || 420,
+ stars,
},
revalidate: 10,
};