: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(frontend): lazy load side panel tabs (#106250)
Paul D'Ambra0cd11289feb3
diff --git a/frontend/bin/check-eager-graph.mjs b/frontend/bin/check-eager-graph.mjsindex 8caf80a2f801..33f3786d8f75 100644--- a/frontend/bin/check-eager-graph.mjs+++ b/frontend/bin/check-eager-graph.mjs@@ -91,9 +91,9 @@ const ROOTS = [{root: AUTHENTICATED_SHELL,label: 'authenticated shell (every logged-in page)',- // 2026-09-11: 8.27 MiB eager output = 6.91 MiB JS (2688 files) + the 1.36 MiB linked+ // 2026-09-24: 7.25 MiB eager output = 5.86 MiB JS (2292 files) + the 1.39 MiB linked// stylesheet. ~15% headroom so routine churn doesn't trip the warn.- budgetBytes: 9_970_000,+ budgetBytes: 8_745_000,forbidden: ['node_modules/monaco-editor/','src/lib/components/ActivityLog/describers',diff --git a/frontend/src/layout/navigation-3000/sidepanel/SidePanel.tsx b/frontend/src/layout/navigation-3000/sidepanel/SidePanel.tsxindex 5b5f826150f9..d19e79b5e428 100644--- a/frontend/src/layout/navigation-3000/sidepanel/SidePanel.tsx+++ b/frontend/src/layout/navigation-3000/sidepanel/SidePanel.tsx@@ -19,6 +19,22 @@ const NotebookPanel = lazyWithRetry(() =>const SidePanelSupport = lazyWithRetry(() =>import('./panels/support/SidePanelSupport').then((m) => ({ default: m.SidePanelSupport })))+// Discussion renders the comment composer, which pulls in the rich content editor and emoji picker.+const SidePanelDiscussion = lazyWithRetry(() =>+ import('./panels/discussion/SidePanelDiscussion').then((m) => ({ default: m.SidePanelDiscussion }))+)+const SidePanelAccessControl = lazyWithRetry(() =>+ import('./panels/access_control/SidePanelAccessControl').then((m) => ({ default: m.SidePanelAccessControl }))+)+const SidePanelAccessDetail = lazyWithRetry(() =>+ import('./panels/access_control/SidePanelAccessDetail').then((m) => ({ default: m.SidePanelAccessDetail }))+)+const SidePanelExports = lazyWithRetry(() =>+ import('./panels/exports/SidePanelExports').then((m) => ({ default: m.SidePanelExports }))+)+const SidePanelActivity = lazyWithRetry(() =>+ import('./panels/activity/SidePanelActivity').then((m) => ({ default: m.SidePanelActivity }))+)import { useWindowSize } from 'lib/hooks/useWindowSize'@@ -29,11 +45,9 @@ import { SidePanelTab } from '~/types'import { SidePanelSupportIcon } from 'products/conversations/frontend/components/SidePanel/SidePanelSupportIcon'-import { SidePanelAccessControl } from './panels/access_control/SidePanelAccessControl'-import { SidePanelAccessDetail } from './panels/access_control/SidePanelAccessDetail'-import { SidePanelActivity, SidePanelActivityIcon } from './panels/activity/SidePanelActivity'-import { SidePanelDiscussion, SidePanelDiscussionIcon } from './panels/discussion/SidePanelDiscussion'-import { SidePanelExports, SidePanelExportsIcon } from './panels/exports/SidePanelExports'+import { SidePanelActivityIcon } from './panels/activity/SidePanelActivityIcon'+import { SidePanelDiscussionIcon } from './panels/discussion/SidePanelDiscussionIcon'+import { SidePanelExportsIcon } from './panels/exports/SidePanelExportsIcon'import { SidePanelInfo, SidePanelInfoIcon } from './panels/info/SidePanelInfo'import { SidePanelMax } from './panels/max/SidePanelMax'import { sidePanelLogic } from './sidePanelLogic'diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/activity/SidePanelActivity.tsx b/frontend/src/layout/navigation-3000/sidepanel/panels/activity/SidePanelActivity.tsxindex 1d99b5d0cc4b..9f64a6f38152 100644--- a/frontend/src/layout/navigation-3000/sidepanel/panels/activity/SidePanelActivity.tsx+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/activity/SidePanelActivity.tsx@@ -11,7 +11,6 @@ import { MemberSelect } from 'lib/components/MemberSelect'import { PayGateMini } from 'lib/components/PayGateMini/PayGateMini'import { ScrollableShadows } from 'lib/components/ScrollableShadows/ScrollableShadows'import { FEATURE_FLAGS } from 'lib/constants'-import { IconWithCount } from 'lib/lemon-ui/icons'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { userHasAccess } from 'lib/utils/accessControlUtils'import { urls } from 'scenes/urls'@@ -22,7 +21,6 @@ import {SidePanelActivityTab,sidePanelActivityLogic,} from '~/layout/navigation-3000/sidepanel/panels/activity/sidePanelActivityLogic'-import { sidePanelNotificationsLogic } from '~/layout/navigation-3000/sidepanel/panels/activity/sidePanelNotificationsLogic'import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'import {AccessControlLevel,@@ -37,16 +35,6 @@ import { SidePanelActivityMetalytics } from './SidePanelActivityMetalytics'const SCROLL_TRIGGER_OFFSET = 100-export const SidePanelActivityIcon = (props: { className?: string }): JSX.Element => {- const { unreadCount } = useValues(sidePanelNotificationsLogic)-- return (- <IconWithCount count={unreadCount} {...props}>- <IconNotification />- </IconWithCount>- )-}-export const SidePanelActivity = (): JSX.Element => {const { activeTab, contextFromPage } = useValues(sidePanelActivityLogic)const { setActiveTab } = useActions(sidePanelActivityLogic)diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/activity/SidePanelActivityIcon.tsx b/frontend/src/layout/navigation-3000/sidepanel/panels/activity/SidePanelActivityIcon.tsxnew file mode 100644index 000000000000..c30b371ce738--- /dev/null+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/activity/SidePanelActivityIcon.tsx@@ -0,0 +1,17 @@+import { useValues } from 'kea'++import { IconNotification } from '@posthog/icons'++import { IconWithCount } from 'lib/lemon-ui/icons'++import { sidePanelNotificationsLogic } from './sidePanelNotificationsLogic'++export const SidePanelActivityIcon = (props: { className?: string }): JSX.Element => {+ const { unreadCount } = useValues(sidePanelNotificationsLogic)++ return (+ <IconWithCount count={unreadCount} {...props}>+ <IconNotification />+ </IconWithCount>+ )+}diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/discussion/SidePanelDiscussion.tsx b/frontend/src/layout/navigation-3000/sidepanel/panels/discussion/SidePanelDiscussion.tsxindex 35f9a5f00c66..404fb1f29819 100644--- a/frontend/src/layout/navigation-3000/sidepanel/panels/discussion/SidePanelDiscussion.tsx+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/discussion/SidePanelDiscussion.tsx@@ -2,14 +2,12 @@ import { useActions, useValues } from 'kea'import { useEffect } from 'react'import * as stopPng from '@posthog/brand/hoggies/png/stop'-import { IconChat } from '@posthog/icons'import { pngHoggie } from 'lib/brand/hoggies'import { humanizeScope } from 'lib/components/ActivityLog/humanizeActivity'import { CommentComposer } from 'lib/components/Comments/CommentComposer'import { CommentsList } from 'lib/components/Comments/CommentsList'import { CommentsLogicProps, commentsLogic } from 'lib/components/Comments/commentsLogic'-import { IconWithCount } from 'lib/lemon-ui/icons'import { SidePanelPaneHeader } from '../../components/SidePanelPaneHeader'import { SidePanelContentContainer } from '../../SidePanelContentContainer'@@ -18,16 +16,6 @@ import { sidePanelDiscussionLogic } from './sidePanelDiscussionLogic'const HedgehogStop = pngHoggie(stopPng)-export const SidePanelDiscussionIcon = (props: { className?: string }): JSX.Element => {- const { commentCount } = useValues(sidePanelDiscussionLogic)-- return (- <IconWithCount count={commentCount} {...props}>- <IconChat />- </IconWithCount>- )-}-export const SidePanelDiscussion = (): JSX.Element => {const { commentsLogicProps } = useValues(sidePanelDiscussionLogic)const { scope, item_id } = commentsLogicProps ?? {}diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/discussion/SidePanelDiscussionIcon.tsx b/frontend/src/layout/navigation-3000/sidepanel/panels/discussion/SidePanelDiscussionIcon.tsxnew file mode 100644index 000000000000..997185c8226d--- /dev/null+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/discussion/SidePanelDiscussionIcon.tsx@@ -0,0 +1,17 @@+import { useValues } from 'kea'++import { IconChat } from '@posthog/icons'++import { IconWithCount } from 'lib/lemon-ui/icons'++import { sidePanelDiscussionLogic } from './sidePanelDiscussionLogic'++export const SidePanelDiscussionIcon = (props: { className?: string }): JSX.Element => {+ const { commentCount } = useValues(sidePanelDiscussionLogic)++ return (+ <IconWithCount count={commentCount} {...props}>+ <IconChat />+ </IconWithCount>+ )+}diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/exports/SidePanelExports.tsx b/frontend/src/layout/navigation-3000/sidepanel/panels/exports/SidePanelExports.tsxindex 132688b6ecb7..e5df3514a747 100644--- a/frontend/src/layout/navigation-3000/sidepanel/panels/exports/SidePanelExports.tsx+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/exports/SidePanelExports.tsx@@ -9,7 +9,6 @@ import { getExportDisabledReason, getExportPendingLabel } from 'lib/components/Eimport { ScreenShotEditor } from 'lib/components/TakeScreenshot/ScreenShotEditor'import { takeScreenshotLogic } from 'lib/components/TakeScreenshot/takeScreenshotLogic'import { dayjs } from 'lib/dayjs'-import { IconWithCount } from 'lib/lemon-ui/icons'import { humanFriendlyNumber } from 'lib/utils/numbers'import { AccessControlLevel, AccessControlResourceType, ExportedAssetType, ExporterFormat } from '~/types'@@ -19,15 +18,6 @@ import { sidePanelExportsLogic } from './sidePanelExportsLogic'const ROW_LIMIT_IN_THOUSANDS = 300-export const SidePanelExportsIcon = (): JSX.Element => {- const { freshUndownloadedExports } = useValues(sidePanelExportsLogic)- return (- <IconWithCount count={freshUndownloadedExports.length}>- <IconDownload />- </IconWithCount>- )-}-function ExportPanelHeader(): JSX.Element {const { assetFormat, exportsLoading } = useValues(sidePanelExportsLogic)const { loadExports, setAssetFormat } = useActions(sidePanelExportsLogic)diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/exports/SidePanelExportsIcon.tsx b/frontend/src/layout/navigation-3000/sidepanel/panels/exports/SidePanelExportsIcon.tsxnew file mode 100644index 000000000000..f66a1b85783c--- /dev/null+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/exports/SidePanelExportsIcon.tsx@@ -0,0 +1,16 @@+import { useValues } from 'kea'++import { IconDownload } from '@posthog/icons'++import { IconWithCount } from 'lib/lemon-ui/icons'++import { sidePanelExportsLogic } from './sidePanelExportsLogic'++export const SidePanelExportsIcon = (props: { className?: string }): JSX.Element => {+ const { freshUndownloadedExports } = useValues(sidePanelExportsLogic)+ return (+ <IconWithCount count={freshUndownloadedExports.length} {...props}>+ <IconDownload />+ </IconWithCount>+ )+}