: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(hog-charts): don't throw in bar tooltip when series has no stack entry (#60065)
Sam Penningtonf511eb5108b7
diff --git a/frontend/src/lib/hog-charts/core/bar-layout.test.ts b/frontend/src/lib/hog-charts/core/bar-layout.test.tsindex 5d577b1b0d6c..fda671861b0e 100644--- a/frontend/src/lib/hog-charts/core/bar-layout.test.ts+++ b/frontend/src/lib/hog-charts/core/bar-layout.test.ts@@ -119,12 +119,11 @@ describe('hog-charts bar-layout', () => {expect(bars[0]?.corners).toEqual(expectedCorners)})- it('throws when stackedBand is omitted for non-grouped layouts', () => {+ it('returns nulls when stackedBand is omitted for non-grouped layouts', () => {const s = makeSeries({ key: 's', data: [10] })const scales = createBarScales([s], ['a'], dimensions, { barLayout: 'stacked' })- expect(() => layoutOf({ series: s, scales, layout: 'stacked', isTopOfStack: true })).toThrow(- /stackedBand is required/- )+ const bars = layoutOf({ series: s, scales, layout: 'stacked', isTopOfStack: true })+ expect(bars).toEqual([null])})it('rounds the cap of the topmost visible series per yAxisId (multi-axis stacked)', () => {diff --git a/frontend/src/lib/hog-charts/core/bar-layout.ts b/frontend/src/lib/hog-charts/core/bar-layout.tsindex de8d1c031995..f9018a991b4b 100644--- a/frontend/src/lib/hog-charts/core/bar-layout.ts+++ b/frontend/src/lib/hog-charts/core/bar-layout.ts@@ -100,7 +100,10 @@ export function computeBarAtIndex({}: ComputeBarAtIndexOptions): BarRect | null {const isGrouped = layout === 'grouped'if (!isGrouped && !stackedBand) {- throw new Error(`computeBarAtIndex: stackedBand is required for layout '${layout}'`)+ // Overlay / CI-band series are intentionally excluded from buildStackData, so they+ // have no stackedBand entry. Treat them as non-renderable for the bar layer rather+ // than throwing — hover/tooltip paths iterate every series in the chart context.+ return null}const bandStart = scales.band(label)