: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 web analytics editor filters only when needed (#119023)
Paul D'Ambra52a2db598b08
diff --git a/frontend/bin/check-eager-graph.mjs b/frontend/bin/check-eager-graph.mjsindex d383adf158aa..155841ec75f2 100644--- a/frontend/bin/check-eager-graph.mjs+++ b/frontend/bin/check-eager-graph.mjs@@ -141,13 +141,16 @@ const ROOTS = [root: 'src/scenes/dashboard/Dashboard.tsx',label: 'dashboard scene',// 2026-10-11: 9.33 MiB (3529 files), stable CSS included. ~10% headroom.- budgetBytes: 10_800_000,+ budgetBytes: 10_500_000,forbidden: [// Neither scene plays recordings. A hit means a static import pulled the playlist and player onto it.'src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx',// Only web analytics insights render this tile. A hit means a static import put the web// analytics stack on every page that shows an insight.'src/scenes/web-analytics/tiles/WebAnalyticsTile.tsx',+ // The generated schema validators serve web analytics URL filters. A hit means the web+ // analytics editor filters became a static import of the insight editor.+ 'src/queries/validators.js',],},{@@ -168,13 +171,16 @@ const ROOTS = [root: 'src/scenes/activity/explore/EventsScene.tsx',label: 'events scene',// 2026-10-11: 8.92 MiB (3373 files), stable CSS included. ~10% headroom.- budgetBytes: 10_355_000,+ budgetBytes: 10_055_000,forbidden: [// Neither scene plays recordings. A hit means a static import pulled the playlist and player onto it.'src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx',// Only web analytics insights render this tile. A hit means a static import put the web// analytics stack on every page that shows an insight.'src/scenes/web-analytics/tiles/WebAnalyticsTile.tsx',+ // The generated schema validators serve web analytics URL filters. A hit means the web+ // analytics editor filters became a static import of the insight editor.+ 'src/queries/validators.js',],},{diff --git a/frontend/src/queries/nodes/InsightViz/EditorFilters.tsx b/frontend/src/queries/nodes/InsightViz/EditorFilters.tsxindex 1955f78d58a6..5985e6789260 100644--- a/frontend/src/queries/nodes/InsightViz/EditorFilters.tsx+++ b/frontend/src/queries/nodes/InsightViz/EditorFilters.tsx@@ -1,14 +1,16 @@import { useValues } from 'kea'+import { Suspense, lazy } from 'react'import { IconInfo } from '@posthog/icons'import { Link, Tooltip } from '@posthog/lemon-ui'import { NON_BREAKDOWN_DISPLAY_TYPES } from 'lib/constants'+import { retryImport } from 'lib/utils/retryImport'import { pluralize } from 'lib/utils/strings'+import { ChunkLoadErrorBoundary } from 'scenes/ChunkLoadErrorBoundary'import { GoalLines } from 'scenes/insights/EditorFilters/GoalLines'import { PoeFilter } from 'scenes/insights/EditorFilters/PoeFilter'import { SamplingDeprecationNotice } from 'scenes/insights/EditorFilters/SamplingDeprecationNotice'-import { WebAnalyticsEditorFilters } from 'scenes/insights/EditorFilters/WebAnalyticsEditorFilters'import { insightLogic } from 'scenes/insights/insightLogic'import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'import { userLogic } from 'scenes/userLogic'@@ -52,6 +54,15 @@ import { getBreakdownSummary, getFiltersSummary, getSeriesSummary, visibleFilterimport { GlobalAndOrFilters } from './GlobalAndOrFilters'import { TrendsSeries } from './TrendsSeries'+// Only web analytics insights use these filters, and they pull in the web analytics logic and its schema validators.+const WebAnalyticsEditorFilters = lazy(() =>+ retryImport(() =>+ import('scenes/insights/EditorFilters/WebAnalyticsEditorFilters').then((m) => ({+ default: m.WebAnalyticsEditorFilters,+ }))+ )+)+export interface EditorFiltersProps {query: InsightQueryNodeshowing: boolean@@ -89,11 +100,15 @@ export function EditorFilters({ query, showing, embedded }: EditorFiltersProps):// Web Analytics insights use their custom filter UIif (isWebAnalyticsInsightQuery(query)) {return (- <WebAnalyticsEditorFilters- query={query as WebOverviewQuery | WebStatsTableQuery}- showing={showing}- embedded={embedded}- />+ <ChunkLoadErrorBoundary>+ <Suspense fallback={null}>+ <WebAnalyticsEditorFilters+ query={query as WebOverviewQuery | WebStatsTableQuery}+ showing={showing}+ embedded={embedded}+ />+ </Suspense>+ </ChunkLoadErrorBoundary>)}