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 the auth step event code only on the verify email page (#125883)

Paul D'Ambrac34272e747d0
diff --git a/frontend/bin/check-eager-graph.mjs b/frontend/bin/check-eager-graph.mjs
index 5a4b6698dce5..1247539e0e8f 100644
--- a/frontend/bin/check-eager-graph.mjs
+++ b/frontend/bin/check-eager-graph.mjs
@@ -102,9 +102,8 @@ const ROOTS = [
{
root: AUTHENTICATED_SHELL,
label: 'authenticated shell (every logged-in page)',
- // 2026-10-11: 7.09 MiB eager output = 6.29 MiB JS (2463 files) + 0.80 MiB stable CSS.
- // ~8% headroom so routine churn doesn't trip the warn.
- budgetBytes: 7_860_000,
+ // 2026-10-29: 7.41 MiB eager output, stable CSS included. ~0.5% headroom.
+ budgetBytes: 7_810_000,
forbidden: [
'node_modules/monaco-editor/',
'src/lib/components/ActivityLog/describers',
diff --git a/frontend/src/scenes/authentication/verify-email/verifyEmailLogic.test.ts b/frontend/src/scenes/authentication/verify-email/verifyEmailLogic.test.ts
index 248e545f615d..e1b7cb236496 100644
--- a/frontend/src/scenes/authentication/verify-email/verifyEmailLogic.test.ts
+++ b/frontend/src/scenes/authentication/verify-email/verifyEmailLogic.test.ts
@@ -1,10 +1,14 @@
+import { waitFor } from '@testing-library/react'
import { router } from 'kea-router'
import { expectLogic } from 'kea-test-utils'
+import posthog from 'posthog-js'
import { initKeaTests } from '~/test/init'
import { verifyEmailLogic } from './verifyEmailLogic'
+jest.mock('posthog-js')
+
describe('verifyEmailLogic', () => {
let logic: ReturnType<typeof verifyEmailLogic.build>
@@ -29,6 +33,17 @@ describe('verifyEmailLogic', () => {
})
})
+ it('reports the verify email step once the deep link opens', async () => {
+ router.actions.push('/verify_email/abc-123')
+
+ await waitFor(() =>
+ expect(posthog.capture).toHaveBeenCalledWith(
+ 'auth step viewed',
+ expect.objectContaining({ step: 'verify_email', entry: null })
+ )
+ )
+ })
+
it.each([['unknown_partner'], ['']])('ignores a reason it does not know: %s', async (reason) => {
router.actions.push('/verify_email/abc-123', { reason })
diff --git a/frontend/src/scenes/authentication/verify-email/verifyEmailLogic.ts b/frontend/src/scenes/authentication/verify-email/verifyEmailLogic.ts
index b7e42b650dbb..b7113b717b26 100644
--- a/frontend/src/scenes/authentication/verify-email/verifyEmailLogic.ts
+++ b/frontend/src/scenes/authentication/verify-email/verifyEmailLogic.ts
@@ -5,7 +5,6 @@ import { router, urlToAction } from 'kea-router'
import api from 'lib/api'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { getRelativeNextPath } from 'lib/utils/url'
-import { captureAuthStepViewed } from 'scenes/authentication/shared/authStepViewed'
import {
clearPendingVerificationEmail,
isValidVerificationCode,
@@ -282,7 +281,10 @@ export const verifyEmailLogic = kea<verifyEmailLogicType>([
searchParams.email_sent !== 'false'
)
actions.setView('pending')
- captureAuthStepViewed('verify_email', null)
+ // Lazy: authStepViewed reads the OAuth cookie through `he`, which every logged-in page would otherwise load.
+ void import('scenes/authentication/shared/authStepViewed')
+ .then(({ captureAuthStepViewed }) => captureAuthStepViewed('verify_email', null))
+ .catch(() => {})
}
}
return {