: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(replay-vision): let the wizard back arrow reach the template step (#81424)
Arno Hillenfd5de4cd7ce7
diff --git a/products/replay_vision/frontend/replay_scanners/ScannerEditorScene.tsx b/products/replay_vision/frontend/replay_scanners/ScannerEditorScene.tsxindex 987b3ee154ad..ee8c5b7e1422 100644--- a/products/replay_vision/frontend/replay_scanners/ScannerEditorScene.tsx+++ b/products/replay_vision/frontend/replay_scanners/ScannerEditorScene.tsx@@ -47,13 +47,14 @@ import { replayScannerLogic } from './replayScannerLogic'import {SCANNER_EDITOR_STEPS,SCANNER_EDITOR_STEP_ORDER,+ STEP_LABELS,ScannerEditorStep,UNVALIDATED_SCANNER_STEPS,scannerStepErrors,scannerEditorSceneLogic,scannerStepUrlWithParams,} from './scannerEditorSceneLogic'-import { ScannerEditorStepper, STEP_LABELS } from './ScannerEditorStepper'+import { ScannerEditorStepper } from './ScannerEditorStepper'import { SCANNER_TYPE_OPTIONS, getModelOptions, modelNamingVariant } from './types'const HedgehogConstruction2 = pngHoggie(construction2Png)diff --git a/products/replay_vision/frontend/replay_scanners/ScannerEditorStepper.tsx b/products/replay_vision/frontend/replay_scanners/ScannerEditorStepper.tsxindex 871ffa825346..420a33d66232 100644--- a/products/replay_vision/frontend/replay_scanners/ScannerEditorStepper.tsx+++ b/products/replay_vision/frontend/replay_scanners/ScannerEditorStepper.tsx@@ -3,15 +3,7 @@ import { IconCheckCircle, IconWarning } from '@posthog/icons'import { Tooltip } from 'lib/lemon-ui/Tooltip'import { cn } from 'lib/utils/css-classes'-import { SCANNER_EDITOR_STEP_ORDER, ScannerEditorStep } from './scannerEditorSceneLogic'--export const STEP_LABELS: Record<ScannerEditorStep, string> = {- template: 'Template',- details: 'Details',- configure: 'Configure',- triggers: 'Recordings',- budget: 'Budget',-}+import { SCANNER_EDITOR_STEP_ORDER, STEP_LABELS, ScannerEditorStep } from './scannerEditorSceneLogic'interface ScannerEditorStepperProps {currentStep: ScannerEditorStepdiff --git a/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.test.ts b/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.test.tsindex e3d1c4ac9a69..ccddb3d33e09 100644--- a/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.test.ts+++ b/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.test.ts@@ -71,8 +71,37 @@ describe('scannerEditorSceneLogic', () => {})describe('breadcrumbs', () => {- it('labels the new-scanner trail when creating', async () => {+ it('points the back-arrow crumb at the template step past it when creating', async () => {+ // The scene back arrow navigates to the second-to-last crumb, so the crumb before+ // the current step must be the template picker or the wizard cannot go back.router.actions.push(urls.replayVisionScannerConfigure('new'))+ await expectLogic(logic).toMatchValues({+ breadcrumbs: [+ expect.objectContaining({ key: 'replay-vision', name: 'Replay vision' }),+ expect.objectContaining({+ key: 'new-scanner',+ name: 'New scanner',+ path: urls.replayVisionTemplates(),+ }),+ expect.objectContaining({ key: 'new-scanner-step', name: 'Configure' }),+ ],+ })+ })++ it('keeps the template param on the back-arrow crumb, so going back preserves the type lock', async () => {+ router.actions.push(urls.replayVisionScannerConfigure('new'), { template: 'dead_end' })+ await expectLogic(logic).toMatchValues({+ breadcrumbs: expect.arrayContaining([+ expect.objectContaining({+ key: 'new-scanner',+ path: `${urls.replayVisionTemplates()}?template=dead_end`,+ }),+ ]),+ })+ })++ it('shows no step crumb on the template step, so the back arrow exits to the list', async () => {+ router.actions.push(urls.replayVisionScannerTemplate('new'))await expectLogic(logic).toMatchValues({breadcrumbs: [expect.objectContaining({ key: 'replay-vision', name: 'Replay vision' }),diff --git a/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.ts b/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.tsindex 604af2c87f67..39a9756df83b 100644--- a/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.ts+++ b/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.ts@@ -21,6 +21,13 @@ export const SCANNER_EDITOR_STEP_ORDER: Record<ScannerEditorStep, number> = {triggers: 3,budget: 4,}+export const STEP_LABELS: Record<ScannerEditorStep, string> = {+ template: 'Template',+ details: 'Details',+ configure: 'Configure',+ triggers: 'Recordings',+ budget: 'Budget',+}export interface ScannerFieldErrors {scanner_config?: unknown@@ -99,7 +106,12 @@ export interface scannerEditorSceneLogicActions {export interface scannerEditorSceneLogicMeta {__keaTypeGenInternalSelectorTypes: {isNew: (scannerId: string) => boolean- breadcrumbs: (scannerId: string, isNew: boolean) => Breadcrumb[]+ breadcrumbs: (+ scannerId: string,+ isNew: boolean,+ step: ScannerEditorStep,+ searchParams: Record<string, any>+ ) => Breadcrumb[]}}@@ -140,8 +152,13 @@ export const scannerEditorSceneLogic = kea<scannerEditorSceneLogicType>([selectors({isNew: [(s) => [s.scannerId], (scannerId: string): boolean => scannerId === 'new'],breadcrumbs: [- (s) => [s.scannerId, s.isNew],- (scannerId: string, isNew: boolean): Breadcrumb[] => {+ (s) => [s.scannerId, s.isNew, s.step, router.selectors.searchParams],+ (+ scannerId: string,+ isNew: boolean,+ step: ScannerEditorStep,+ searchParams: Record<string, any>+ ): Breadcrumb[] => {const crumbs: Breadcrumb[] = [{key: 'replay-vision',@@ -151,7 +168,16 @@ export const scannerEditorSceneLogic = kea<scannerEditorSceneLogicType>([},]if (isNew) {- crumbs.push({ key: 'new-scanner', name: 'New scanner', path: urls.replayVision('new') })+ // The back arrow targets the second-to-last crumb, so past the template step the+ // 'New scanner' crumb points at the template picker and the current step trails it.+ crumbs.push({+ key: 'new-scanner',+ name: 'New scanner',+ path: scannerStepUrlWithParams('template', scannerId, searchParams),+ })+ if (step !== 'template') {+ crumbs.push({ key: 'new-scanner-step', name: STEP_LABELS[step] })+ }return crumbs}// Editing an existing scanner: surface the detail page (on its Configuration tab, where the