: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(insights): render pie chart slices when parent has only min-height (#64711)
posthog[bot]a9da8af83002
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex f22c57ccdbad..c7f4c6685ee1 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -588,6 +588,10 @@ snapshots:hash: v1.k794b7964.586cbc343561fe2ea416c4e8a15661d80f0dc0e6602c4c4505fb763a960e3fec.wnr2iqA9493GIdPtZgO3pqa1uiD9pZcM3L01W8_FZ-Qcomponents-hogcharts-defaulttooltip--total-excludes-overlay--light:hash: v1.k794b7964.cf566924008a871da770d7d0a0b7a2ac6748823639d3d60ca60344770f581a2a.7s92rB7AHoeq-uQd_tSJGFVCn3cU-LQeOQVJ2qyvLWo+ components-hogcharts-legend--built-in-toggle--dark:+ hash: v1.k794b7964.a44913b0e0cdf88b5d0d8960560fa4ce5a663f0b187cdcc5a723d1bb9b653fc6.pxcAORXTtyj4dK4h_9PUe9keV7tagKmaBvwS56KoeXI+ components-hogcharts-legend--built-in-toggle--light:+ hash: v1.k794b7964.dc8065b867dd309ca1c05935745e283b13d2fd7ebb7ddde80c9b5e8c24ee6cec.BzRyo-huuWL4HvNyXrykyXbCBuFTjeQKpECqODhn7AEcomponents-hogcharts-legend--horizontal--dark:hash: v1.k794b7964.748c8221979ca1984c3ef06b0a2d5016e683810a2530a2b7549ff2994484d32d.WlgOW_onzflesCUfetduXiySjbl4uF8oTLxdKf4xYsocomponents-hogcharts-legend--horizontal--light:@@ -1997,21 +2001,21 @@ snapshots:exporter-other--sql-insight-no-results--light:hash: v1.k794b7964.ea7aadee0085781453c5672a14fb5ec0a603f4a06b5f3731cd2083f2f9d8734a.c0cjRDa-iJE_e-oAxzjliNErIudaVy2yfaiYXXvETYIexporter-trends--trends-pie-breakdown-insight--dark:- hash: v1.k794b7964.040d0fb7c305cbae453d542dc4006d8982d0b7447aff2b78fd57beda05b2a6be.7xHVE8Wn9Z-mPQrPmsykXkbbIyUpwLbxxEP8abMrA9s+ hash: v1.k794b7964.33bfabe0e9204f2e5d76eb92110bbc90c1f3f77019ec1ed277946083c5328539.uPMNTwfMlFf9LwrXfz2slkstWoJxeNIn7Dn776Fl1fcexporter-trends--trends-pie-breakdown-insight--light:- hash: v1.k794b7964.31a2e0c6d76ca26d4a25381eb9328ad6e78f1c8166dd5908c92e9fda9ebf0cb7.tN56CqGBVQ_ze-bFVFFFQdIY8kfo7sZ_dbndEUbDi9s+ hash: v1.k794b7964.abbc48cab2d5c76fec7fbd4de53cf488854d35c7ac7da08419e4a7f00af1c3fb.ErU9gaAUPkKfVBcjYIxx43zSKXjmB0Cz5BINZ14xJTUexporter-trends--trends-pie-insight--dark:- hash: v1.k794b7964.5567dea526a9e577eddb14ce9a5fd8d4ea7c758958362f6b0fcb986826f7af6c.BttinJQgRpIFhK_2oMdJvfPlGb3u2TuIPR9b5c3F5IA+ hash: v1.k794b7964.cd250e9722a4c620c85542a91d285fbbe6f5da6c0cbc03e329edd0ef4d561607.jPAtU4NheTMtx6dDroEANO6n-HGKS5BqyvHI0K_FBRoexporter-trends--trends-pie-insight--light:- hash: v1.k794b7964.49005eebac3838c7cd116d05d4437c60a37df7140109f6d2c060a5bdb4634805.qNLqShPQR3uPsDCb7JnHpl9ze8ZgGo-kXeX2jKnbBac+ hash: v1.k794b7964.56a3af56a35351b482a198d09f3d375f28131f113d30e41dc68c82a87e6667a2.QUg1cGENPTxE9PgO5b6cdtje0nDeCBSeMPD_khlECS0exporter-trends--trends-pie-insight-detailed--dark:- hash: v1.k794b7964.7b0ea60087952b08123f941ab77e17f9094da142c85d74c28f365d3be39df60a.Gv9kPX0uHM3fSMlqMnKed3lj9bT4VmGOLZWMpen04dk+ hash: v1.k794b7964.fd05974a57b9721b40cc8d8e8eca8ea62ec3d319fd358cf8763dbed66b59a0a8.CuwUX4LrLrC1UhVHvzaSZSKd9tht0Ou_DeyhCpeh3BAexporter-trends--trends-pie-insight-detailed--light:- hash: v1.k794b7964.f7d3aa7722b466bbb25840760927387c3f41dbde736df2cdefb94006a91bfbe6.ZTZCr0bVsj6Z1Lj4diIJBBtJyXn0paakEClTGeISThc+ hash: v1.k794b7964.4b3dc5c1ac8094d0c48ee7a731279c42e272174094ee092e2ac7779c937aef9c.0NgmX4_0qEgTnWwoI1U6bWc5UH2wqG2HzqQdn6udpv8exporter-trends--trends-pie-insight-legend--dark:- hash: v1.k794b7964.feadacff7e7c0da2d0e6ac69b8e4a9f00045750fef453cbcf6ea517385e4dad3.nUi-EgSqX1UXqPXhzaTkcqFj4jc5bceX9ejfX98LU0I+ hash: v1.k794b7964.7c88b9ccf583ff6527b997ac16a63ca9172547b6c56ce9842fc968a4b4fee8a0.3zGT_2mZlZJtpobr6CuQ0q8HeP5vcXPEImGbROHgnd4exporter-trends--trends-pie-insight-legend--light:- hash: v1.k794b7964.98cb2e5267e4fc26990e40659030b30414bb17294addb372bb9dd977130f2037.bPeMndRVn99lBi22GJPu3kwLC6Z-4sXlMgXVMOcXmqc+ hash: v1.k794b7964.a4aa386a7fccbe94d96d86e259ce76de1080df615b6a3fe3ee14954d39de87ce.ZqMY25Bb78GHUAvNCKmaCt6N9ia-N0U3aTY1QMRGn_wexporter-trends--trends-table-breakdown-insight--dark:hash: v1.k794b7964.b405c1ec4fac6926a7d94ab64146c3db056e5c5521a9e532dd2cdd663472b24c.ot1LJLLfiQQHdyUE3WZ_LUuEGzLcBYBegDMBTRYNI8sexporter-trends--trends-table-breakdown-insight--light:@@ -2508,6 +2512,10 @@ snapshots:hash: v1.k794b7964.f48431d18162f354bc4740a7b7d83975c46e7bc154dfcbb12639434d4f372ff1.ZIxjDiGV7z8DnS5jhxryJSm88gERo__Fsa3BEnlr7cEinsights-trendspiechart--default--light:hash: v1.k794b7964.6c1baad55ed61d997f367df06da05cc718e43e228de1b5d99916e808acf52b36.KwbeSMAFlL1HCP3UzwfguNGu79ewS5NXgFbb6KaYJpw+ insights-trendspiechart--min-height-parent--dark:+ hash: v1.k794b7964.889edbc09e14e53381cbb016cb220cbfb6f05a98cca0f6fa21cdc501db2e2bc4.R97K3OA3xWtihRzzaMlRFyPB3sLEjuG9sEUCvc8GGew+ insights-trendspiechart--min-height-parent--light:+ hash: v1.k794b7964.b6233aadfc83aec40901c2cd6608c5d88e44eefbd25e6e7afea09d570a05de85.sC0C-N63ohQAoOAgqvXNynRlZJuvrwP-dwyQY6-jRUMlayout-feature-previews--basic--dark:hash: v1.k794b7964.65cb2d154c4f630bc48a9f6b45b24e641c97b4412ca5170e0c1de8bc5c7d759d.vu2XHwyh2oLXbqNS7NdZd2tABaC8nM7J0iJps6FVYl8layout-feature-previews--basic--light:diff --git a/products/product_analytics/frontend/insights/trends/TrendsPieChart/TrendsPieChart.stories.tsx b/products/product_analytics/frontend/insights/trends/TrendsPieChart/TrendsPieChart.stories.tsxindex 152c39394241..b10a91f9c5dc 100644--- a/products/product_analytics/frontend/insights/trends/TrendsPieChart/TrendsPieChart.stories.tsx+++ b/products/product_analytics/frontend/insights/trends/TrendsPieChart/TrendsPieChart.stories.tsx@@ -49,7 +49,17 @@ function Stage({ children }: { children: React.ReactNode }): JSX.Element {)}-function renderTrendsPieChart(insightFixture: any): JSX.Element {+// Mirrors the production layout (`.TrendsInsight`): a flex column whose height comes from+// `min-height` only, with no explicit `height`. A wrapper relying on `h-full` collapses to 0+// here and the pie renders no slices — this stage guards that regression.+function MinHeightStage({ children }: { children: React.ReactNode }): JSX.Element {+ return (+ // eslint-disable-next-line react/forbid-dom-props+ <div style={{ minHeight: 360, width: 720, display: 'flex', flexDirection: 'column' }}>{children}</div>+ )+}++function renderTrendsPieChart(insightFixture: any, StageComponent: typeof Stage = Stage): JSX.Element {const [dashboardItemId] = useState(() => `TrendsPieChartStory.${uniqueNode++}` as InsightShortId)const cachedInsight = { ...insightFixture, short_id: dashboardItemId }@@ -64,9 +74,9 @@ function renderTrendsPieChart(insightFixture: any): JSX.Element {return (<BindLogic logic={insightLogic} props={insightProps}><BindLogic logic={dataNodeLogic} props={dataNodeLogicProps}>- <Stage>+ <StageComponent><TrendsPieChart />- </Stage>+ </StageComponent></BindLogic></BindLogic>)@@ -80,6 +90,12 @@ export const Breakdown: Story = {render: () => renderTrendsPieChart(trendsPieBreakdownFixture),}+// Parent supplies height via `min-height` only (as `.TrendsInsight` does) — verifies the chart+// still sizes itself and renders slices rather than collapsing to the bare aggregation total.+export const MinHeightParent: Story = {+ render: () => renderTrendsPieChart(trendsPieBreakdownFixture, MinHeightStage),+}+export const BreakdownWithLabels: Story = {render: () =>renderTrendsPieChart({diff --git a/products/product_analytics/frontend/insights/trends/TrendsPieChart/TrendsPieChart.tsx b/products/product_analytics/frontend/insights/trends/TrendsPieChart/TrendsPieChart.tsxindex 881d91cfa75b..71aef3555bc0 100644--- a/products/product_analytics/frontend/insights/trends/TrendsPieChart/TrendsPieChart.tsx+++ b/products/product_analytics/frontend/insights/trends/TrendsPieChart/TrendsPieChart.tsx@@ -235,7 +235,10 @@ export function TrendsPieChart({ context, showPersonsModal = true }: TrendsPieCh}return (- <div className="flex flex-col w-full h-full">+ // `flex-1 min-h-0` (not `h-full`) so the chart fills the flex column even when the+ // parent only sets `min-height`/`flex` — a percentage height would collapse to 0,+ // leaving `PieChart` with `outerRadius <= 0` and no slices. Mirrors the bar/line charts.+ <div className="flex flex-col w-full flex-1 min-h-0"><PieChart<TrendsSeriesMeta>series={series}theme={theme}