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.

perf(frontend): load three unused shell dependencies on demand (#105032)

Paul D'Ambrab568c5835817
diff --git a/frontend/src/layout/GlobalModals.tsx b/frontend/src/layout/GlobalModals.tsx
index 5364ec86340e..63ff71e30f82 100644
--- a/frontend/src/layout/GlobalModals.tsx
+++ b/frontend/src/layout/GlobalModals.tsx
@@ -24,7 +24,7 @@ import { InviteModal } from 'scenes/settings/organization/InviteModal'
import { PreviewingCustomCssModal } from 'scenes/themes/PreviewingCustomCssModal'
import { MaybeWelcomeDialog } from 'scenes/welcome/WelcomeDialog'
-import { ComposeTicketModal } from 'products/conversations/frontend/components/ComposeTicket'
+import { composeTicketLogic } from 'products/conversations/frontend/components/ComposeTicket/composeTicketLogic'
import { logsViewerModalLogic } from 'products/logs/frontend/components/LogsViewer/LogsViewerModal/logsViewerModalLogic'
import { globalModalsLogic } from './globalModalsLogic'
@@ -46,6 +46,13 @@ const LogsViewerModal = lazyWithRetry(() =>
}))
)
+// The compose ticket modal anchors the support rich text editor (tiptap and prosemirror).
+const ComposeTicketModal = lazyWithRetry(() =>
+ import('products/conversations/frontend/components/ComposeTicket/ComposeTicketModal').then((m) => ({
+ default: m.ComposeTicketModal,
+ }))
+)
+
export function GlobalModals(): JSX.Element {
const { isCreateOrganizationModalShown, isCreateProjectModalShown } = useValues(globalModalsLogic)
const { hideCreateOrganizationModal, hideCreateProjectModal } = useActions(globalModalsLogic)
@@ -54,6 +61,8 @@ export function GlobalModals(): JSX.Element {
// Grace-extended so the modals' exit animations finish before the lazy subtree unmounts.
const shouldRenderSessionPlayerModal = useKeepMountedWhileOpen(!!activeSessionRecording)
const shouldRenderLogsViewerModal = useKeepMountedWhileOpen(isLogsViewerModalOpen)
+ const { isOpen: isComposeTicketModalOpen } = useValues(composeTicketLogic)
+ const shouldRenderComposeTicketModal = useKeepMountedWhileOpen(isComposeTicketModalOpen)
const { isInviteModalShown } = useValues(inviteLogic)
const { hideInviteModal } = useActions(inviteLogic)
const { superpowersEnabled } = useValues(superpowersLogic)
@@ -90,7 +99,11 @@ export function GlobalModals(): JSX.Element {
<MaybeWelcomeDialog />
<MaybeProductPushWelcome />
<MaybePhaiOnboarding />
- <ComposeTicketModal />
+ {shouldRenderComposeTicketModal ? (
+ <Suspense fallback={null}>
+ <ComposeTicketModal />
+ </Suspense>
+ ) : null}
</>
)
}
diff --git a/frontend/src/layout/navigation-3000/navigationLogic.tsx b/frontend/src/layout/navigation-3000/navigationLogic.tsx
index 1b906275771b..8d70b61f45f7 100644
--- a/frontend/src/layout/navigation-3000/navigationLogic.tsx
+++ b/frontend/src/layout/navigation-3000/navigationLogic.tsx
@@ -35,7 +35,6 @@ import { LemonMenuOverlay } from 'lib/lemon-ui/LemonMenu/LemonMenu'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { getAppContext } from 'lib/utils/getAppContext'
import { isNotNil } from 'lib/utils/guards'
-import { editorSceneLogic } from 'scenes/data-warehouse/editor/editorSceneLogic'
import { onboardingVariantChrome, resolveOnboardingFlowVariant } from 'scenes/onboarding/onboardingVariants'
import { organizationLogic } from 'scenes/organizationLogic'
import { sceneLogic } from 'scenes/sceneLogic'
@@ -835,7 +834,6 @@ export const navigation3000Logic = kea<navigation3000LogicType>([
label: 'SQL editor',
icon: <IconServer />,
to: urls.sqlEditor(),
- logic: editorSceneLogic,
tooltipDocLink: 'https://posthog.com/docs/data-warehouse/query#querying-sources-with-sql',
},
{
diff --git a/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx b/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx
index 4b0dfb731be3..919a37cb5fa9 100644
--- a/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx
+++ b/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx
@@ -122,7 +122,7 @@ import { CohortRealtimeTag } from 'products/cohorts/frontend/realtime/CohortReal
import { joinsLogic } from 'products/data_warehouse/frontend/shared/logics/joinsLogic'
import { experimentsLogic } from 'products/experiments/frontend/scenes/experimentsLogic'
import { groupDisplayId } from 'products/persons/frontend/components/GroupActorDisplay'
-import { HogFlowTaxonomicFilters } from 'products/workflows/frontend/Workflows/hogflows/filters/HogFlowTaxonomicFilters'
+import { LazyHogFlowTaxonomicFilters } from 'products/workflows/frontend/Workflows/hogflows/filters/LazyHogFlowTaxonomicFilters'
import type { Noun } from '../../../models/groupsModel'
import type { DatabaseSchemaDataWarehouseTable } from '../../../queries/schema/schema-general'
@@ -1251,7 +1251,7 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([
searchPlaceholder: 'variable key',
type: TaxonomicFilterGroupType.WorkflowVariables,
categoryLabel: () => 'Workflow variables',
- render: HogFlowTaxonomicFilters,
+ render: LazyHogFlowTaxonomicFilters,
// Populated via optionsFromProp from the workflow scene so the All/Suggestions
// tab can aggregate workflow variables alongside other groups. The render
// override above still drives the dedicated tab UI.
diff --git a/frontend/src/lib/components/TaxonomicFilter/utils/buildTaxonomicGroups.tsx b/frontend/src/lib/components/TaxonomicFilter/utils/buildTaxonomicGroups.tsx
index bcf6f4e5e3aa..de2f14236cfe 100644
--- a/frontend/src/lib/components/TaxonomicFilter/utils/buildTaxonomicGroups.tsx
+++ b/frontend/src/lib/components/TaxonomicFilter/utils/buildTaxonomicGroups.tsx
@@ -76,7 +76,7 @@ import {
import { CohortRealtimeTag } from 'products/cohorts/frontend/realtime/CohortRealtimeTag'
import { joinsLogic } from 'products/data_warehouse/frontend/shared/logics/joinsLogic'
import { experimentsLogic } from 'products/experiments/frontend/scenes/experimentsLogic'
-import { HogFlowTaxonomicFilters } from 'products/workflows/frontend/Workflows/hogflows/filters/HogFlowTaxonomicFilters'
+import { LazyHogFlowTaxonomicFilters } from 'products/workflows/frontend/Workflows/hogflows/filters/LazyHogFlowTaxonomicFilters'
import { InlineHogQLEditor } from '../InlineHogQLEditor'
@@ -279,7 +279,7 @@ export function buildTaxonomicGroups(ctx: BuildTaxonomicGroupsContext): Taxonomi
searchPlaceholder: 'variable key',
type: TaxonomicFilterGroupType.WorkflowVariables,
categoryLabel: () => 'Workflow variables',
- render: HogFlowTaxonomicFilters,
+ render: LazyHogFlowTaxonomicFilters,
getPopoverHeader: () => 'Workflow variables',
},
{
diff --git a/products/workflows/frontend/Workflows/hogflows/filters/LazyHogFlowTaxonomicFilters.tsx b/products/workflows/frontend/Workflows/hogflows/filters/LazyHogFlowTaxonomicFilters.tsx
new file mode 100644
index 000000000000..85886dc9c18e
--- /dev/null
+++ b/products/workflows/frontend/Workflows/hogflows/filters/LazyHogFlowTaxonomicFilters.tsx
@@ -0,0 +1,20 @@
+import { Suspense } from 'react'
+
+import type { TaxonomicFilterRenderProps } from 'lib/components/TaxonomicFilter/types'
+import { Spinner } from 'lib/lemon-ui/Spinner'
+import { lazyWithRetry } from 'lib/utils/retryImport'
+
+// The workflow variables tab needs workflowLogic, which pulls in liquid and the hog function
+// configuration logic. The taxonomic filter logic is on the path of every logged-in page, so load
+// the tab only when it renders.
+const HogFlowTaxonomicFilters = lazyWithRetry(() =>
+ import('./HogFlowTaxonomicFilters').then((m) => ({ default: m.HogFlowTaxonomicFilters }))
+)
+
+export function LazyHogFlowTaxonomicFilters(props: TaxonomicFilterRenderProps): JSX.Element {
+ return (
+ <Suspense fallback={<Spinner />}>
+ <HogFlowTaxonomicFilters {...props} />
+ </Suspense>
+ )
+}