: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): guard against an empty events retention response (#117343)
posthog[bot]cb90ccd8e88f
diff --git a/frontend/src/scenes/insights/dataRetention/dataRetentionBannerLogic.test.ts b/frontend/src/scenes/insights/dataRetention/dataRetentionBannerLogic.test.tsindex a4e46302505a..defa62aefade 100644--- a/frontend/src/scenes/insights/dataRetention/dataRetentionBannerLogic.test.ts+++ b/frontend/src/scenes/insights/dataRetention/dataRetentionBannerLogic.test.ts@@ -28,6 +28,11 @@ describe('dataRetentionBannerLogic', () => {response: [200, { ...RETENTION, retention_months: null, retained_from: null }],retentionMonths: null,},+ {+ name: 'treats an empty response as retention not enforced',+ response: [204],+ retentionMonths: null,+ },])('$name', async ({ response, retentionMonths }) => {useMocks({ get: { '/api/projects/:team_id/events_retention/': () => response } })initKeaTests()diff --git a/frontend/src/scenes/insights/dataRetention/dataRetentionBannerLogic.ts b/frontend/src/scenes/insights/dataRetention/dataRetentionBannerLogic.tsindex 4ebf8c63f4bc..747d94d9cdcc 100644--- a/frontend/src/scenes/insights/dataRetention/dataRetentionBannerLogic.ts+++ b/frontend/src/scenes/insights/dataRetention/dataRetentionBannerLogic.ts@@ -102,7 +102,7 @@ export const dataRetentionBannerLogic = kea<dataRetentionBannerLogicType>([return null}const retention = await eventsRetentionRetrieve(String(values.currentTeamId))- return retention.retention_months ?? null+ return retention?.retention_months ?? null},},],