Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

fix: Prevent NaN% in the pre-hydration fallback

Blue Mouseb887bee5aad1
diff --git a/web/app/pages/Project/tabs/Traffic/MetricCards.tsx b/web/app/pages/Project/tabs/Traffic/MetricCards.tsx
index 5e0d13622..c336bb908 100644
--- a/web/app/pages/Project/tabs/Traffic/MetricCards.tsx
+++ b/web/app/pages/Project/tabs/Traffic/MetricCards.tsx
@@ -90,11 +90,12 @@ const AnimatedPercent = ({ value }: { value: number }) => {
const PercentFlow = ({ value }: { value: number }) => {
const isHydrated = useIsHydrated()
+ const sanitizedValue = Number.isFinite(value) ? _round(value, 1) : 0
return isHydrated ? (
- <AnimatedPercent value={value} />
+ <AnimatedPercent value={sanitizedValue} />
) : (
- <>{_round(value, 1)}%</>
+ <>{sanitizedValue}%</>
)
}