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(feature-flags): make disable only the primary disable action (#81111)

Ben Whitecf505b27f854
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 0e15fe0d47bc..b63566f3a602 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -176,7 +176,7 @@ export const FEATURE_FLAGS = {
// UX flags, used to control the UX of the app
CMD_K_NAV_EXPERIMENT: 'cmd-k-nav-experiment', // owner: @rafaeelaudibert #team-platform-ux multivariate=control,search-bar,footer-hint,tools-row,footer-callout - surfaces the Cmd+K command menu more prominently in the left nav: search-bar = full-width search field below the nav header, footer-hint = extra Search row in the nav footer, tools-row = Search row after the Tools item in the Project section, footer-callout = dismissible callout card in the nav ad slot for users a few days after signup
CREATE_BUTTON_NAV_EXPERIMENT: 'create-button-nav-experiment', // owner: #team-platform-ux multivariate=control,test — adds a Create dropdown to the top of the Browse tab in the left nav
- FEATURE_FLAG_DISABLE_AND_ARCHIVE_EXPERIMENT: 'feature-flag-disable-and-archive-experiment', // owner: #team-feature-flags multivariate=control,test, makes "Disable and archive" the primary CTA in the disable-flag confirmation dialog, control keeps the plain disable confirmation
+ FEATURE_FLAG_DISABLE_AND_ARCHIVE_EXPERIMENT: 'feature-flag-disable-and-archive-experiment', // owner: #team-feature-flags multivariate=control,test, adds a destructive "Disable and archive" option alongside "Disable only" in the disable-flag confirmation dialog, control keeps the plain disable confirmation
INSIGHT_NOTIFICATION_ENTRYPOINT: 'insight-notification-entrypoint', // owner: #team-product-analytics multivariate=control,notifications,get-updates,monitor — tests notification-entry-point copy against the prominent Subscribe button
STARRED_REORDER: 'starred-reorder', // owner: #team-platform-ux, drag-and-drop reorder of starred shortcuts in the side panel
UX_HIDE_PROJECT_NOTICE: 'ux-hide-project-notice', // owner: #team-platform-ux, hides the project notice banner across all scenes
diff --git a/frontend/src/scenes/feature-flags/featureFlagDisableDialog.test.ts b/frontend/src/scenes/feature-flags/featureFlagDisableDialog.test.ts
index c35d345abae6..cdfa4e840658 100644
--- a/frontend/src/scenes/feature-flags/featureFlagDisableDialog.test.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagDisableDialog.test.ts
@@ -59,8 +59,11 @@ describe('openFeatureFlagDisableDialog', () => {
open()
expect(openControlDialog).not.toHaveBeenCalled()
- expect(openDialog.mock.calls[0][0].primaryButton.children).toBe('Disable and archive')
- expect(openDialog.mock.calls[0][0].secondaryButton.children).toBe('Disable only')
+ expect(openDialog.mock.calls[0][0].primaryButton.children).toBe('Disable only')
+ expect(openDialog.mock.calls[0][0].secondaryButton).toMatchObject({
+ children: 'Disable and archive',
+ status: 'danger',
+ })
})
it.each<[string, string | boolean]>([
@@ -79,8 +82,8 @@ describe('openFeatureFlagDisableDialog', () => {
describe('option telemetry', () => {
// A fresh dialog per case, so each one can assert the other callback stayed untouched.
it.each<[FeatureFlagDisableDialogOption, 'primaryButton' | 'secondaryButton' | 'tertiaryButton']>([
- ['disable_and_archive', 'primaryButton'],
- ['disable', 'secondaryButton'],
+ ['disable', 'primaryButton'],
+ ['disable_and_archive', 'secondaryButton'],
['cancel', 'tertiaryButton'],
])('reports %s and runs only its own callback', (option, button) => {
setVariant('test')
diff --git a/frontend/src/scenes/feature-flags/featureFlagDisableDialog.tsx b/frontend/src/scenes/feature-flags/featureFlagDisableDialog.tsx
index 5be74690db76..64848e9504a8 100644
--- a/frontend/src/scenes/feature-flags/featureFlagDisableDialog.tsx
+++ b/frontend/src/scenes/feature-flags/featureFlagDisableDialog.tsx
@@ -18,8 +18,8 @@ export function reportFeatureFlagDisableDialogOptionSelected(
/**
* Opens the disable confirmation dialog for a feature flag. The test variant of the
- * disable-and-archive experiment gets "Disable and archive" as the primary CTA alongside a
- * "Disable only" option; control keeps each caller's pre-existing dialog, with this dialog's own
+ * disable-and-archive experiment gets "Disable only" as the primary CTA alongside a destructive
+ * "Disable and archive" option; control keeps each caller's pre-existing dialog, with this dialog's own
* option-selected telemetry wrapped around the caller's confirm/cancel. The experiment flag is
* read here rather than at render so the exposure lines up with the dialog actually opening.
*/
@@ -64,16 +64,17 @@ export function openFeatureFlagDisableDialog({
description:
'This flag will be immediately rolled back from the users matching the release conditions. Done with it for good? Archive it too: archived flags are hidden from the flag list, but linked experiments and surveys keep their data.',
primaryButton: {
- children: 'Disable and archive',
+ children: 'Disable only',
type: 'primary',
size: 'small',
- onClick: selectDisableAndArchive,
+ onClick: selectDisable,
},
secondaryButton: {
- children: 'Disable only',
+ children: 'Disable and archive',
type: 'secondary',
+ status: 'danger',
size: 'small',
- onClick: selectDisable,
+ onClick: selectDisableAndArchive,
},
tertiaryButton: {
children: 'Cancel',
diff --git a/frontend/src/scenes/feature-flags/featureFlagLogic.test.ts b/frontend/src/scenes/feature-flags/featureFlagLogic.test.ts
index 69f7246e105b..6026ed6de824 100644
--- a/frontend/src/scenes/feature-flags/featureFlagLogic.test.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagLogic.test.ts
@@ -2005,9 +2005,9 @@ describe('featureFlagLogic', () => {
await expectLogic(logic, () => logic.actions.toggleFeatureFlagActive(false)).toFinishAllListeners()
const dialogProps = dialogOpenSpy.mock.calls[0][0]
- expect(dialogProps.primaryButton?.children).toBe('Disable and archive')
+ expect(dialogProps.secondaryButton?.children).toBe('Disable and archive')
- dialogProps.primaryButton?.onClick?.(undefined as any)
+ dialogProps.secondaryButton?.onClick?.(undefined as any)
await expectLogic(logic).toFinishAllListeners()
expect(capturesOf('feature flag archived')).toEqual([
diff --git a/frontend/src/scenes/feature-flags/featureFlagsLogic.test.ts b/frontend/src/scenes/feature-flags/featureFlagsLogic.test.ts
index 96f40c9137a0..483945943ddd 100644
--- a/frontend/src/scenes/feature-flags/featureFlagsLogic.test.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagsLogic.test.ts
@@ -443,9 +443,9 @@ describe('updateFeatureFlagArchived', () => {
})
logic.actions.toggleFeatureFlagActive(1, false)
- expect(openDialog.mock.calls[0][0].primaryButton?.children).toBe('Disable and archive')
+ expect(openDialog.mock.calls[0][0].secondaryButton?.children).toBe('Disable and archive')
- openDialog.mock.calls[0][0].primaryButton?.onClick?.(undefined as any)
+ openDialog.mock.calls[0][0].secondaryButton?.onClick?.(undefined as any)
await expectLogic(logic).toFinishAllListeners()
expect(capturesOf('feature flag archived')).toEqual([