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.

fix(onboarding): wire skip installation to advance self-driving flow (#91950)

Iago Dahlem70a1dd0d7c83
diff --git a/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/NextButton.test.tsx b/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/NextButton.test.tsx
new file mode 100644
index 000000000000..96a9617e20f7
--- /dev/null
+++ b/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/NextButton.test.tsx
@@ -0,0 +1,55 @@
+import '@testing-library/jest-dom'
+
+import { cleanup, fireEvent, render, screen } from '@testing-library/react'
+import posthog from 'posthog-js'
+
+import { ProductKey } from '~/queries/schema/schema-general'
+import { initKeaTests } from '~/test/init'
+
+import { onboardingLogic } from '../../onboardingLogic'
+import { NextButton } from './NextButton'
+
+describe('NextButton', () => {
+ let logic: ReturnType<typeof onboardingLogic.build>
+
+ beforeEach(() => {
+ localStorage.clear()
+ initKeaTests()
+ logic = onboardingLogic()
+ logic.mount()
+ logic.actions.setProductKey(ProductKey.PRODUCT_ANALYTICS)
+ logic.actions.setStepId('install:product_analytics')
+ })
+
+ afterEach(() => {
+ logic.unmount()
+ cleanup()
+ })
+
+ it('falls back to the legacy step machine when no override is supplied', () => {
+ render(<NextButton installationComplete={false} />)
+
+ fireEvent.click(screen.getByText('Skip installation'))
+
+ expect(logic.values.stepId).toBe('configure:product_analytics')
+ })
+
+ it('calls the supplied override instead of the legacy step machine (self-driving)', () => {
+ // Regression test for the self-driving "Skip installation" dead click: the modal
+ // that hosts this button reuses the legacy NextButton, which used to always dispatch
+ // into the legacy onboardingLogic step machine that self-driving never reads.
+ const onAdvance = jest.fn()
+ const capture = jest.spyOn(posthog, 'capture')
+
+ render(<NextButton installationComplete={false} onAdvance={onAdvance} />)
+
+ fireEvent.click(screen.getByText('Skip installation'))
+
+ expect(onAdvance).toHaveBeenCalledTimes(1)
+ // The legacy machine must stay untouched when an override is supplied.
+ expect(logic.values.stepId).toBe('install:product_analytics')
+ expect(capture.mock.calls.map((call) => call[0])).toContain('onboarding step skipped')
+
+ capture.mockRestore()
+ })
+})
diff --git a/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/NextButton.tsx b/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/NextButton.tsx
index a6c3ea9bba26..5d6a20e62949 100644
--- a/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/NextButton.tsx
+++ b/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/NextButton.tsx
@@ -12,14 +12,16 @@ import { onboardingLogic } from '../../onboardingLogic'
interface NextButtonProps {
installationComplete: boolean
size?: 'small' | 'medium'
+ /** Overrides the legacy onboardingLogic advance for flows (e.g. self-driving) that manage their own step state. */
+ onAdvance?: () => void
}
-export const NextButton = ({ installationComplete, size = 'medium' }: NextButtonProps): JSX.Element => {
+export const NextButton = ({ installationComplete, size = 'medium', onAdvance }: NextButtonProps): JSX.Element => {
const { hasNextStep, currentStepProductKey } = useValues(onboardingLogic)
const { completeOnboarding, goToNextStep } = useActions(onboardingLogic)
const { reportOnboardingStepCompleted, reportOnboardingStepSkipped } = useActions(eventUsageLogic)
- const advance = !hasNextStep ? completeOnboarding : goToNextStep
+ const advance = onAdvance ?? (!hasNextStep ? completeOnboarding : goToNextStep)
const skipInstallation = (): void => {
reportOnboardingStepSkipped(OnboardingStepKey.INSTALL, currentStepProductKey ?? undefined)
advance()
diff --git a/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/SDKInstructionsModal.tsx b/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/SDKInstructionsModal.tsx
index 36b77cd257df..1c428a56424d 100644
--- a/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/SDKInstructionsModal.tsx
+++ b/frontend/src/scenes/onboarding/legacy/sdks/OnboardingInstallStep/SDKInstructionsModal.tsx
@@ -18,6 +18,8 @@ interface SDKInstructionsModalProps {
verifyingProperty?: string
verifyingName?: string
hideInstallationCheck?: boolean
+ /** Overrides the legacy onboardingLogic advance the footer's NextButton dispatches by default. */
+ onAdvance?: () => void
}
export function SDKInstructionsModal({
@@ -29,6 +31,7 @@ export function SDKInstructionsModal({
verifyingProperty = 'ingested_event',
verifyingName = 'event',
hideInstallationCheck = false,
+ onAdvance,
}: SDKInstructionsModalProps): JSX.Element {
const installationCompleteFromTeam = useInstallationComplete(verifyingProperty)
const installationComplete = hideInstallationCheck || installationCompleteFromTeam
@@ -65,7 +68,7 @@ export function SDKInstructionsModal({
) : (
<span />
)}
- <NextButton installationComplete={installationComplete} />
+ <NextButton installationComplete={installationComplete} onAdvance={onAdvance} />
</footer>
</div>
)}
diff --git a/frontend/src/scenes/onboarding/self-driving/SelfDrivingOnboardingFlow.tsx b/frontend/src/scenes/onboarding/self-driving/SelfDrivingOnboardingFlow.tsx
index 296cfb27e7f0..55e0b79b9d90 100644
--- a/frontend/src/scenes/onboarding/self-driving/SelfDrivingOnboardingFlow.tsx
+++ b/frontend/src/scenes/onboarding/self-driving/SelfDrivingOnboardingFlow.tsx
@@ -270,7 +270,7 @@ export function SelfDrivingOnboardingFlow(): JSX.Element {
)}
{!step.hideContinue && (
<div className="flex items-center gap-2">
- {step.id === 'install' && <ManualSetupButton />}
+ {step.id === 'install' && <ManualSetupButton onAdvance={advance} />}
<LemonButton
type="primary"
status="alt"
diff --git a/frontend/src/scenes/onboarding/self-driving/components/SelfDrivingInstallOptions.tsx b/frontend/src/scenes/onboarding/self-driving/components/SelfDrivingInstallOptions.tsx
index 66f962f41bcd..58445298b548 100644
--- a/frontend/src/scenes/onboarding/self-driving/components/SelfDrivingInstallOptions.tsx
+++ b/frontend/src/scenes/onboarding/self-driving/components/SelfDrivingInstallOptions.tsx
@@ -138,7 +138,7 @@ export function SelfDrivingInstallOptions({ onContinue }: { onContinue: () => vo
* Opens the legacy manual-setup dialog: the SDK grid, then per-SDK instructions. Picking an SDK
* closes the grid and opens the instructions; closing the instructions reopens the grid.
*/
-export function ManualSetupButton(): JSX.Element {
+export function ManualSetupButton({ onAdvance }: { onAdvance: () => void }): JSX.Element {
const { reportOnboardingInstallModeSelected } = useActions(onboardingEventUsageLogic)
const { setAvailableSDKInstructionsMap, selectSDK, setSearchTerm, setSelectedTag } = useActions(sdksLogic)
const { filteredSDKs, selectedSDK, tags, searchTerm, selectedTag } = useValues(sdksLogic)
@@ -201,6 +201,7 @@ export function ManualSetupButton(): JSX.Element {
adblockResult={adblockResult}
verifyingProperty="ingested_event"
verifyingName="event"
+ onAdvance={onAdvance}
/>
)}
</>