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(error-tracking): avoid kea store crash when mini breakdowns unmount mid-query (#72264)

Hugues Pouillot74beba2df8da
diff --git a/products/error_tracking/frontend/components/Breakdowns/miniBreakdownsLogic.ts b/products/error_tracking/frontend/components/Breakdowns/miniBreakdownsLogic.ts
index 842b0ff60fbc..eaef971fc6f2 100644
--- a/products/error_tracking/frontend/components/Breakdowns/miniBreakdownsLogic.ts
+++ b/products/error_tracking/frontend/components/Breakdowns/miniBreakdownsLogic.ts
@@ -87,12 +87,16 @@ export const miniBreakdownsLogic = kea<miniBreakdownsLogicType>([
{
loadResponse: async () => {
const startTime = Date.now()
+ // Read connected values up front: the logic (and its connected breakdownFiltersLogic)
+ // may unmount while the query is in flight, and accessing values afterwards would throw.
+ const { dateRange, filterTestAccounts } = values
+ const breakdownProperties = BREAKDOWN_PRESETS.map((preset) => preset.property)
const result = await api.query(
errorTrackingBreakdownsQuery({
issueId: props.issueId,
- dateRange: values.dateRange,
- filterTestAccounts: values.filterTestAccounts,
- breakdownProperties: BREAKDOWN_PRESETS.map((preset) => preset.property),
+ dateRange,
+ filterTestAccounts,
+ breakdownProperties,
maxValuesPerProperty: LIMIT_ITEMS,
}),
{ refresh: 'blocking' }
@@ -100,9 +104,9 @@ export const miniBreakdownsLogic = kea<miniBreakdownsLogicType>([
posthog.capture(BreakdownsEvents.MiniBreakdownsLoaded, {
issueId: props.issueId,
- dateRange: values.dateRange,
- filterTestAccounts: values.filterTestAccounts,
- breakdownProperties: BREAKDOWN_PRESETS.map((preset) => preset.property),
+ dateRange,
+ filterTestAccounts,
+ breakdownProperties,
duration: Date.now() - startTime,
cached: (result as CachedErrorTrackingBreakdownsQueryResponse).is_cached ?? false,
})