From 38eb10db51fc63b34d6dbd1d329769df9b7c5aa5 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 28 Nov 2026 10:45:16 -0500 Subject: [PATCH] chore: Remove client feature flag system (#14791) --- app/actions/definitions/developer.tsx | 26 ---------- app/utils/FeatureFlags.ts | 75 --------------------------- 2 files changed, 101 deletions(-) delete mode 100644 app/utils/FeatureFlags.ts diff --git a/app/actions/definitions/developer.tsx b/app/actions/definitions/developer.tsx index d7cf387dd3..6205bdd4bc 100644 --- a/app/actions/definitions/developer.tsx +++ b/app/actions/definitions/developer.tsx @@ -17,7 +17,6 @@ import { import { DeveloperSection } from "~/actions/sections"; import env from "~/env"; import { client } from "~/utils/ApiClient"; -import { Feature, FeatureFlags } from "~/utils/FeatureFlags"; import Logger from "~/utils/Logger"; import { deleteAllDatabases } from "~/utils/developer"; import history from "~/utils/history"; @@ -216,30 +215,6 @@ export const toggleDebugSafeArea = createAction({ }, }); -export const toggleFeatureFlag = createActionWithChildren({ - name: "Toggle feature flag", - icon: , - section: DeveloperSection, - visible: () => env.ENVIRONMENT === "development", - children: Object.values(Feature).map((flag) => - createAction({ - id: `flag-${flag}`, - name: flag, - selected: () => FeatureFlags.isEnabled(flag), - section: DeveloperSection, - perform: () => { - if (FeatureFlags.isEnabled(flag)) { - FeatureFlags.disable(flag); - toast.success(`Disabled feature flag: ${flag}`); - } else { - FeatureFlags.enable(flag); - toast.success(`Enabled feature flag: ${flag}`); - } - }, - }) - ), -}); - export const developer = createActionWithChildren({ name: ({ t }) => t("Development"), keywords: "debug", @@ -251,7 +226,6 @@ export const developer = createActionWithChildren({ copyId, toggleDebugLogging, toggleDebugSafeArea, - toggleFeatureFlag, createToast, createTestUsers, createTestNotifications, diff --git a/app/utils/FeatureFlags.ts b/app/utils/FeatureFlags.ts deleted file mode 100644 index 2c4ef639c9..0000000000 --- a/app/utils/FeatureFlags.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { makeObservable, observable, runInAction } from "mobx"; -import Storage from "@shared/utils/Storage"; - -/** - * Available feature flags that can be toggled per-client. - */ -export enum Feature { - /** New collection permissions UI */ - newCollectionSharing = "newCollectionSharing", -} - -/** Default values for feature flags */ -const FeatureDefaults: Record = { - [Feature.newCollectionSharing]: true, -}; - -/** - * A simple feature flagging system that stores flags in browser storage. - */ -export class FeatureFlags { - /** - * Checks whether a feature flag is currently enabled. - * - * @param flag the feature flag to check. - * @returns true if the flag is enabled. - */ - public static isEnabled(flag: Feature) { - // init on first read - if (this.initialized === false) { - runInAction(() => { - this.cache = new Set(); - for (const key of Object.values(Feature)) { - const value = Storage.get(key); - if (value === true) { - this.cache.add(key); - } - } - this.initialized = true; - }); - } - - return this.cache.has(flag) ? true : (FeatureDefaults[flag] ?? false); - } - - /** - * Enables a feature flag and persists the value to browser storage. - * - * @param flag the feature flag to enable. - */ - public static enable(flag: Feature) { - runInAction(() => { - this.cache.add(flag); - }); - Storage.set(flag, true); - } - - /** - * Disables a feature flag and persists the value to browser storage. - * - * @param flag the feature flag to disable. - */ - public static disable(flag: Feature) { - runInAction(() => { - this.cache.delete(flag); - }); - Storage.set(flag, false); - } - - @observable - private static cache: Set = new Set(); - - private static initialized = false; -} - -makeObservable(FeatureFlags);