: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
perf(insights): load insightLogic lazily from getInsightId (#126841)
Paul D'Ambraa4967eb725bb
diff --git a/frontend/src/scenes/insights/utils.tsx b/frontend/src/scenes/insights/utils.tsxindex 50941257a29d..fc3ea440a535 100644--- a/frontend/src/scenes/insights/utils.tsx+++ b/frontend/src/scenes/insights/utils.tsx@@ -12,6 +12,7 @@ import { isEmptyObject, isObject } from 'lib/utils/guards'import { humanFriendlyNumber } from 'lib/utils/numbers'import { objectsEqual } from 'lib/utils/objects'import { removeUndefinedAndNull } from 'lib/utils/objects'+import { retryImport } from 'lib/utils/retryImport'import { ensureStringIsNotBlank } from 'lib/utils/strings'import { queryUsesFiltersPlaceholder } from 'scenes/data-warehouse/editor/sql-utils'import { isWarehouseSeriesNode } from 'scenes/insights/filters/ActionFilter/seriesNode'@@ -77,8 +78,6 @@ import {import { IndexedTrendResult } from 'products/product_analytics/frontend/insights/trends/types'-import { insightLogic } from './insightLogic'-export const isAllEventsEntityFilter = (filter: EntityFilter | ActionFilter | null | undefined): boolean => {return (filter != null &&@@ -202,6 +201,8 @@ export function extractObjectDiffKeys(}export async function getInsightId(shortId: InsightShortId): Promise<number | undefined> {+ // A static import would put insightLogic and everything it imports on the eager path of every page.+ const { insightLogic } = await retryImport(() => import('./insightLogic'))const insightId = insightLogic.findMounted({ dashboardItemId: shortId })?.values?.insight?.idreturn insightId