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(onboarding): lazy load the wizard sync buttons in the shell (#126309)

Paul D'Ambra5d7bc345367f
diff --git a/frontend/src/scenes/AuthenticatedShell.tsx b/frontend/src/scenes/AuthenticatedShell.tsx
index 4291e8196bf4..a312dc280b23 100644
--- a/frontend/src/scenes/AuthenticatedShell.tsx
+++ b/frontend/src/scenes/AuthenticatedShell.tsx
@@ -13,9 +13,9 @@ import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { isEmbeddedPageFrame } from 'lib/utils/embeddedPageFrame'
import { lazyWithRetry } from 'lib/utils/retryImport'
import { billingLogic } from 'scenes/billing/billingLogic'
+import { ChunkLoadErrorBoundary } from 'scenes/ChunkLoadErrorBoundary'
import { WizardHandoffDialog } from 'scenes/onboarding/shared/wizard-sync/WizardHandoffDialog'
import { WizardSyncDebugPanel } from 'scenes/onboarding/shared/wizard-sync/WizardSyncDebugPanel'
-import { WizardSyncFab } from 'scenes/onboarding/shared/wizard-sync/WizardSyncFab'
import { userLogic } from 'scenes/userLogic'
import { ErrorBoundary } from '~/layout/ErrorBoundary'
@@ -27,7 +27,6 @@ import { breadcrumbsLogic } from '~/layout/navigation/Breadcrumbs/breadcrumbsLog
import { ImpersonationNotice } from '~/layout/navigation/ImpersonationNotice'
import { webmcpLogic } from 'products/webmcp/frontend/logics/webmcpLogic'
-import { WizardRunSyncFab } from 'products/wizard/frontend/runs/WizardRunSyncFab'
import { sceneLogic } from './sceneLogic'
@@ -40,6 +39,18 @@ const InternalFeedbackWidget = lazyWithRetry(() =>
default: InternalFeedbackWidget,
}))
)
+// Deciding whether a run is active takes API polls, so the shell cannot gate these cheaply.
+// Lazy loading keeps their logic and generated API clients off the first paint instead.
+const WizardSyncFab = lazyWithRetry(() =>
+ import('scenes/onboarding/shared/wizard-sync/WizardSyncFab').then(({ WizardSyncFab }) => ({
+ default: WizardSyncFab,
+ }))
+)
+const WizardRunSyncFab = lazyWithRetry(() =>
+ import('products/wizard/frontend/runs/WizardRunSyncFab').then(({ WizardRunSyncFab }) => ({
+ default: WizardRunSyncFab,
+ }))
+)
export default function AuthenticatedShell({ children }: { children: React.ReactNode }): JSX.Element {
useMountedLogic(apiStatusLogic)
@@ -97,7 +108,11 @@ export default function AuthenticatedShell({ children }: { children: React.React
)}
<Command />
<ImpersonationNotice />
- {runSyncEnabled ? <WizardRunSyncFab /> : <WizardSyncFab />}
+ <ErrorBoundary>
+ <ChunkLoadErrorBoundary>
+ <Suspense fallback={null}>{runSyncEnabled ? <WizardRunSyncFab /> : <WizardSyncFab />}</Suspense>
+ </ChunkLoadErrorBoundary>
+ </ErrorBoundary>
{/* Separate from the FAB: the FAB stands down while an inline panel shows the run,
but the doc dialog must be able to open from any surface. */}
<WizardHandoffDialog />