Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(experiments): don't crash metric tooltip on null values (#100194)

Juraj Majerik972146702bd3
diff --git a/frontend/src/scenes/experiments/MetricsView/new/MetricRowGroupTooltip.tsx b/frontend/src/scenes/experiments/MetricsView/new/MetricRowGroupTooltip.tsx
index beab82668645..df076ca7ea43 100644
--- a/frontend/src/scenes/experiments/MetricsView/new/MetricRowGroupTooltip.tsx
+++ b/frontend/src/scenes/experiments/MetricsView/new/MetricRowGroupTooltip.tsx
@@ -43,12 +43,18 @@ export const renderTooltipContent = (
<div className="flex justify-between items-center">
<span className="text-muted-alt font-semibold">Total value:</span>
- <span className="font-semibold">{humanFriendlyNumber(variantResult.sum)}</span>
+ <span className="font-semibold">
+ {variantResult.sum != null ? humanFriendlyNumber(variantResult.sum) : '–'}
+ </span>
</div>
<div className="flex justify-between items-center">
<span className="text-muted-alt font-semibold">Exposures:</span>
- <span className="font-semibold">{humanFriendlyNumber(variantResult.number_of_samples)}</span>
+ <span className="font-semibold">
+ {variantResult.number_of_samples != null
+ ? humanFriendlyNumber(variantResult.number_of_samples)
+ : '–'}
+ </span>
</div>
{isBayesianResult(variantResult) ? (