: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
chore(frontend): lazy-load the replay submenu in the project tree (#126884)
Paul D'Ambra5e80c2cd6f25
diff --git a/frontend/bin/check-eager-graph.mjs b/frontend/bin/check-eager-graph.mjsindex c3419b771fe7..991a9c1c7814 100644--- a/frontend/bin/check-eager-graph.mjs+++ b/frontend/bin/check-eager-graph.mjs@@ -119,6 +119,8 @@ const ROOTS = [verifyPrefix: 'products/dashboards/frontend/widgets/',},'src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts',+ // The replay submenu of the project tree pulls in the playlist and saved filter logics.+ 'src/layout/panel-layout/ProjectTree/menus/SessionReplayMenuItems.tsx',// The wizard run card opens this drawer on click, and the drawer pulls in quill primitives.'products/wizard/frontend/runs/WizardRunDetailsDrawer.tsx',// The Today layout renders only behind the today-rail-nav flag, and it pulls in quill primitives.diff --git a/frontend/src/layout/panel-layout/ProjectTree/menus/MenuItems.tsx b/frontend/src/layout/panel-layout/ProjectTree/menus/MenuItems.tsxindex b33f30c76305..1d627d25c904 100644--- a/frontend/src/layout/panel-layout/ProjectTree/menus/MenuItems.tsx+++ b/frontend/src/layout/panel-layout/ProjectTree/menus/MenuItems.tsx@@ -1,6 +1,6 @@import { useActions, useValues } from 'kea'import { router } from 'kea-router'-import { useState } from 'react'+import { Suspense, useState } from 'react'import {IconArrowRight,@@ -34,6 +34,7 @@ import {DropdownMenuSubTrigger,} from 'lib/ui/DropdownMenu/DropdownMenu'import { removeProjectIdIfPresent } from 'lib/utils/kea-router'+import { lazyWithRetry } from 'lib/utils/retryImport'import { pluralize } from 'lib/utils/strings'import { openDeleteGroupTypeDialog } from 'scenes/settings/environment/GroupAnalyticsConfig'import { groupAnalyticsConfigLogic } from 'scenes/settings/environment/groupAnalyticsConfigLogic'@@ -50,7 +51,11 @@ import { joinPath, splitPath } from '../utils'import { BrowserLikeMenuItems } from './BrowserLikeMenuItems'import { DashboardsMenuItems } from './DashboardsMenuItems'import { ProductAnalyticsMenuItems } from './ProductAnalyticsMenuItems'-import { SessionReplayMenuItems } from './SessionReplayMenuItems'++// The submenu pulls in the replay playlist and saved filter logics, and it renders only when the replay menu opens.+const SessionReplayMenuItems = lazyWithRetry(() =>+ import('./SessionReplayMenuItems').then(({ SessionReplayMenuItems }) => ({ default: SessionReplayMenuItems }))+)interface MenuItemsProps {item: TreeDataItem@@ -130,7 +135,7 @@ export function MenuItems({<MenuSeparator /></>) : showProductMenuItems && item.name === 'Session replay' ? (- <>+ <Suspense fallback={null}><SessionReplayMenuItemsMenuItem={MenuItem}MenuSub={MenuSub}@@ -141,7 +146,7 @@ export function MenuItems({onLinkClick={(keyboardAction) => resetPanelLayout(keyboardAction ?? false)}/><MenuSeparator />- </>+ </Suspense>) : showProductMenuItems && item.name === 'Dashboards' ? (<><DashboardsMenuItems