From d9bd0cb86a954ca74d662d75a29d7941a8b3bef7 Mon Sep 17 00:00:00 2001 From: platform-mcp Date: Wed, 17 Jun 2026 11:23:12 +0530 Subject: [PATCH] fix(homepage): stop stats counters from getting stuck at "0" The stats tiles ("Projects Delivered" etc.) could end up frozen at 0+/0%/0+/0 whenever the IntersectionObserver never fired (tall sections on mobile, threshold too strict, JS error, prefers-reduced-motion). - Server-render the final value as the initial textContent so the numbers are correct on first paint, with JS disabled, and on any hydration failure. - Lower observer threshold to 0.1 and add rootMargin so the animation triggers reliably on tall viewports. - Detect prefers-reduced-motion and render the final value without animating. - Fall back to immediate animation when IntersectionObserver is unavailable or the section is already in view at load. - Reset to 0 only at the moment the animation starts (and snap to the exact target at the end) so a mid-flight failure can never leave the counter visibly stuck. - Boot all homepage scripts after DOMContentLoaded. --- src/pages/index.astro | 76 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 67 insertions(+), 9 deletions(-) diff --git a/src/pages/index.astro b/src/pages/index.astro index 406787a..a9e1308 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -492,7 +492,7 @@ const faqs = [
- 0{stat.suffix} + {stat.value}{stat.suffix}
{stat.label}
@@ -792,14 +792,33 @@ const faqs = [