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.

feat(frontend): mark the css gate, app boot and first app render (#119102)

Paul D'Ambraf52bd85c27f1
diff --git a/frontend/src/index.tsx b/frontend/src/index.tsx
index 554761d364cc..fe053105b8f8 100644
--- a/frontend/src/index.tsx
+++ b/frontend/src/index.tsx
@@ -38,6 +38,7 @@ function loadAppModules(): Promise<AppModules> {
const App = lazy(() =>
loadAppModules().then(([appModule, bootModule]) => {
bootModule.bootApp()
+ markBootPhase('app_booted')
return { default: appModule.App }
})
)
@@ -123,6 +124,7 @@ function boot(): void {
// `null` is the gate expiring on a sheet that is only slow. The loader keeps working on it
// in the background, so render now rather than hold the app back.
if (applied !== false) {
+ markBootPhase('css_ready')
renderApp()
}
})
diff --git a/frontend/src/lib/utils/bootTiming.ts b/frontend/src/lib/utils/bootTiming.ts
index ca9ff296ce07..79870900e1ce 100644
--- a/frontend/src/lib/utils/bootTiming.ts
+++ b/frontend/src/lib/utils/bootTiming.ts
@@ -2,7 +2,15 @@
const BOOT_TIMING_EVENT = 'app boot timing'
const SAMPLE_RATE = 0.05
-export type BootPhase = 'entry' | 'app_modules_loaded' | 'app_ready' | 'scene_loaded' | 'scene_rendered'
+export type BootPhase =
+ | 'entry'
+ | 'app_modules_loaded'
+ | 'css_ready'
+ | 'app_booted'
+ | 'app_first_render'
+ | 'app_ready'
+ | 'scene_loaded'
+ | 'scene_rendered'
export interface BootContext {
scene?: string
diff --git a/frontend/src/scenes/App.tsx b/frontend/src/scenes/App.tsx
index b2a249a8642f..ba62fce32cdf 100644
--- a/frontend/src/scenes/App.tsx
+++ b/frontend/src/scenes/App.tsx
@@ -96,6 +96,8 @@ export function App(): JSX.Element | null {
useThemedHtml()
+ useLayoutEffect(() => markBootPhase('app_first_render'), [])
+
// A cloud OAuth redirect lands at /oauth/callback on the local origin. Render the exchange
// screen here (oauthLogic's urlToAction performs the token exchange), before normal routing.
if (window.location.pathname === '/oauth/callback') {