: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(frontend): open the internal-user filter gear in a new tab (#86916)
Kim Svatos Dugan84ae90177fad
diff --git a/frontend/src/lib/components/TestAccountFiltersSwitch.tsx b/frontend/src/lib/components/TestAccountFiltersSwitch.tsxindex f52252a87b7c..cfd3e610eefe 100644--- a/frontend/src/lib/components/TestAccountFiltersSwitch.tsx+++ b/frontend/src/lib/components/TestAccountFiltersSwitch.tsx@@ -61,12 +61,18 @@ export function TestAccountFilterSwitch({label={<div className="flex items-center"><span>Filter out internal and test users</span>+ {/* Opens in a new tab: this switch sits inside forms that hold unsaved work (a+ half-built scanner, an unsaved cohort, an insight in progress), and the+ disabledReason below actively sends people here when no filters are set up. */}<LemonButtonicon={<IconGear />}size="small"noPaddingclassName="ml-1"to={urls.settings('environment-customization', 'internal-user-filtering')}+ targetBlank+ hideExternalLinkIcon+ tooltip="Configure internal and test users. Opens in a new tab."/></div>}diff --git a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.test.ts b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.test.tsindex e92e94c3e5d3..6e480c7fac2a 100644--- a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.test.ts+++ b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.test.ts@@ -605,6 +605,26 @@ describe('replayScannerLogic', () => {info.mockRestore()})+ // Leaving mid-wizard is routine (the recordings step links out to settings), so resuming has to+ // land where the work was. Always returning to the first step reads as having lost the later ones.+ it('resumes on the step the last edit was made on', async () => {+ const info = jest.spyOn(lemonToast, 'info')+ const editorLogic = scannerEditorSceneLogic()+ editorLogic.mount()+ try {+ editorLogic.actions.setStep('budget')+ logic.actions.setScannerValues({ name: 'Drafted' })+ logic.unmount()++ info.mock.calls[0][1]?.button?.action?.()+ expect(router.values.location.pathname).toContain(urls.replayVisionScannerBudget('new'))+ } finally {+ info.mockRestore()+ editorLogic.unmount()+ router.actions.push(urls.replayVision())+ }+ })+it('stays quiet on the way out when the draft was only restored', async () => {logic.actions.setScannerValues({ name: 'Drafted' })logic.unmount()diff --git a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.tsindex 84e05ea52b82..fc06ced4d8ee 100644--- a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts+++ b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts@@ -1449,6 +1449,9 @@ export const replayScannerLogic = kea<replayScannerLogicType>([clearScannerDraft()}cache.draftTouched = savedAt !== null+ // Recorded here for the resume toast. By the time the scene unmounts the router already+ // points at wherever the user navigated, so the step has to be captured while editing.+ cache.lastEditedStep = scannerEditorSceneLogic.findMounted()?.values.step ?? cache.lastEditedStepactions.setScannerDraftSavedAt(savedAt)}return {@@ -2117,10 +2120,15 @@ export const replayScannerLogic = kea<replayScannerLogicType>([beforeUnmount(({ values, props, cache }) => {if (props.id === 'new' && cache.draftTouched && values.scannerDraftSavedAt !== null) {+ // Back to the step the last edit was on, not always the first one — returning to details+ // after editing recordings or budget reads as having lost those steps, even though the+ // values were restored. The template step holds no edits, so it falls through to details.+ const step = cache.lastEditedStep+ const resumeUrl = scannerStepUrl(step && step !== 'template' ? step : 'details', 'new')lemonToast.info('Draft saved', {button: {label: 'Resume',- action: () => router.actions.push(urls.replayVisionScannerDetails('new')),+ action: () => router.actions.push(resumeUrl),dataAttr: 'vision-draft-resume-toast',},})