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.

chore(posthog-ai): remove the unreachable onboarding finish path (#115956)

Shy Alterfbca03c6e130
diff --git a/products/posthog_ai/frontend/components/onboarding/AiOnboardingImpl.tsx b/products/posthog_ai/frontend/components/onboarding/AiOnboardingImpl.tsx
index 7f95b5b72007..a6db0e697399 100644
--- a/products/posthog_ai/frontend/components/onboarding/AiOnboardingImpl.tsx
+++ b/products/posthog_ai/frontend/components/onboarding/AiOnboardingImpl.tsx
@@ -88,9 +88,7 @@ export interface AiOnboardingProps extends AiOnboardingLogicProps {
export function AiOnboarding({ panelId, autoOpen }: AiOnboardingProps): JSX.Element | null {
const logicProps: AiOnboardingLogicProps = useMemo(() => ({ panelId }), [panelId])
const { isOpen, stepIndex, hasSeenOnboarding, user } = useValues(aiOnboardingLogic(logicProps))
- const { openOnboarding, closeOnboarding, finishOnboarding, setStepIndex, replayMedia } = useActions(
- aiOnboardingLogic(logicProps)
- )
+ const { openOnboarding, closeOnboarding, setStepIndex, replayMedia } = useActions(aiOnboardingLogic(logicProps))
useEffect(() => {
// `user` gates the whole thing: the seen flag lives on it, so acting before it resolves would show
@@ -115,7 +113,6 @@ export function AiOnboarding({ panelId, autoOpen }: AiOnboardingProps): JSX.Elem
stepIndex={stepIndex}
onStepIndexChange={setStepIndex}
onDismiss={closeOnboarding}
- onFinish={finishOnboarding}
onReplayMedia={replayMedia}
stepActions={{
connect: <ConnectGithubAction />,
diff --git a/products/posthog_ai/frontend/components/onboarding/OnboardingTakeover.stories.tsx b/products/posthog_ai/frontend/components/onboarding/OnboardingTakeover.stories.tsx
index d8d3c5e4da5f..bd7ac0f94124 100644
--- a/products/posthog_ai/frontend/components/onboarding/OnboardingTakeover.stories.tsx
+++ b/products/posthog_ai/frontend/components/onboarding/OnboardingTakeover.stories.tsx
@@ -24,7 +24,6 @@ const meta: Meta<OnboardingTakeoverProps> = {
onStepIndexChange={setStepIndex}
stepActions={stepActions}
onDismiss={() => {}}
- onFinish={() => {}}
/>
)
},
diff --git a/products/posthog_ai/frontend/components/onboarding/OnboardingTakeover.test.tsx b/products/posthog_ai/frontend/components/onboarding/OnboardingTakeover.test.tsx
index 2733c5941b05..d2a255c286a8 100644
--- a/products/posthog_ai/frontend/components/onboarding/OnboardingTakeover.test.tsx
+++ b/products/posthog_ai/frontend/components/onboarding/OnboardingTakeover.test.tsx
@@ -16,7 +16,6 @@ describe('OnboardingTakeover', () => {
stepIndex={0}
onStepIndexChange={() => {}}
onDismiss={() => {}}
- onFinish={() => {}}
{...props}
/>
)
diff --git a/products/posthog_ai/frontend/components/onboarding/OnboardingTakeover.tsx b/products/posthog_ai/frontend/components/onboarding/OnboardingTakeover.tsx
index 5ec9fe1c0634..1ecca354cb59 100644
--- a/products/posthog_ai/frontend/components/onboarding/OnboardingTakeover.tsx
+++ b/products/posthog_ai/frontend/components/onboarding/OnboardingTakeover.tsx
@@ -32,8 +32,6 @@ export interface OnboardingTakeoverProps {
stepActions?: Partial<Record<OnboardingStepKey, ReactNode>>
/** Fires on the close button, Esc, and the backdrop. */
onDismiss: () => void
- /** Fires when the user advances past the last step. */
- onFinish: () => void
/** Fires when the user replays a step's clip by hand (only reachable when motion is reduced). */
onReplayMedia?: (step: OnboardingStep) => void
}
@@ -45,7 +43,6 @@ export function OnboardingTakeover({
onStepIndexChange,
stepActions,
onDismiss,
- onFinish,
onReplayMedia,
}: OnboardingTakeoverProps): JSX.Element | null {
const step = steps[stepIndex]
@@ -61,14 +58,6 @@ export function OnboardingTakeover({
[onDismiss]
)
- const handleNext = useCallback((): void => {
- if (isLastStep) {
- onFinish()
- } else {
- onStepIndexChange(stepIndex + 1)
- }
- }, [isLastStep, onFinish, onStepIndexChange, stepIndex])
-
if (!step) {
return null
}
@@ -143,7 +132,7 @@ export function OnboardingTakeover({
<Button
variant="primary"
size="sm"
- onClick={handleNext}
+ onClick={() => onStepIndexChange(stepIndex + 1)}
data-attr="posthog-ai-onboarding-next"
>
Next
diff --git a/products/posthog_ai/frontend/logics/aiOnboardingLogic.test.ts b/products/posthog_ai/frontend/logics/aiOnboardingLogic.test.ts
index b19ef2ad6f57..e6d0ab155ad3 100644
--- a/products/posthog_ai/frontend/logics/aiOnboardingLogic.test.ts
+++ b/products/posthog_ai/frontend/logics/aiOnboardingLogic.test.ts
@@ -133,11 +133,10 @@ describe('aiOnboardingLogic', () => {
})
// A replay opens the takeover on a surface that never showed it, so it has to write nothing on the way
- // out as well as on open. Otherwise dismissing, finishing, or answering a prompt after a replay persists
+ // out as well as on open. Otherwise dismissing or answering a prompt after a replay persists
// the flag and swallows the user's one real first-run showing on the new surface.
it.each([
['dismissed', () => logic.actions.closeOnboarding()],
- ['finished', () => logic.actions.finishOnboarding()],
['answered with a starter prompt', () => logic.actions.selectStarterPrompt('Audit my event tracking.')],
])('writes nothing when a replay is %s', async (_name, exit) => {
mountLogic()
diff --git a/products/posthog_ai/frontend/logics/aiOnboardingLogic.ts b/products/posthog_ai/frontend/logics/aiOnboardingLogic.ts
index da61876f24bc..04fa2d8ba905 100644
--- a/products/posthog_ai/frontend/logics/aiOnboardingLogic.ts
+++ b/products/posthog_ai/frontend/logics/aiOnboardingLogic.ts
@@ -72,9 +72,6 @@ export interface aiOnboardingLogicActions {
closeOnboarding: () => {
value: true
}
- finishOnboarding: () => {
- value: true
- }
markOnboardingSeen: () => {
value: true
}
@@ -157,7 +154,6 @@ export const aiOnboardingLogic = kea<aiOnboardingLogicType>([
actions({
openOnboarding: (isReplay: boolean = false) => ({ isReplay }),
closeOnboarding: true,
- finishOnboarding: true,
setStepIndex: (stepIndex: number) => ({ stepIndex }),
markStepViewed: (stepKey: string) => ({ stepKey }),
selectStarterPrompt: (prompt: string) => ({ prompt }),
@@ -172,7 +168,6 @@ export const aiOnboardingLogic = kea<aiOnboardingLogicType>([
{
openOnboarding: () => true,
closeOnboarding: () => false,
- finishOnboarding: () => false,
selectStarterPrompt: () => false,
},
],
@@ -285,12 +280,6 @@ export const aiOnboardingLogic = kea<aiOnboardingLogicType>([
actions.markOnboardingSeen()
}
},
- finishOnboarding: () => {
- posthog.capture('posthog ai onboarding completed', values.reportProperties)
- if (!values.isReplay) {
- actions.markOnboardingSeen()
- }
- },
selectStarterPrompt: ({ prompt }) => {
posthog.capture('posthog ai onboarding starter prompt clicked', {
...values.reportProperties,