Skip to content

Commit 48f11f5

Browse files
authored
[Feature Flags] Accept several "on" variants (#565)
1 parent b950eea commit 48f11f5

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/ducks/remoteConfig.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { create } from "zustand";
77

88
const ONE_HOUR_IN_MS = 60 * 60 * 1000;
99

10+
// Amplitude variant values that are considered "on"
11+
const ON_VARIANT_VALUES = ["on", "true", "enabled", "yes"];
12+
1013
// Feature flags configuration arrays
1114
const BOOLEAN_FLAGS = [
1215
"swap_enabled",
@@ -120,7 +123,7 @@ export const useRemoteConfigStore = create<RemoteConfigState>()((set, get) => ({
120123
if (BOOLEAN_FLAGS.includes(key as (typeof BOOLEAN_FLAGS)[number])) {
121124
const booleanKey = key as keyof BooleanFeatureFlags;
122125
(updates as BooleanFeatureFlags)[booleanKey] =
123-
variant.value === "on";
126+
ON_VARIANT_VALUES.includes(variant.value);
124127
}
125128
// Handle version flags - use value directly after parsing version strings
126129
else if (
@@ -136,7 +139,7 @@ export const useRemoteConfigStore = create<RemoteConfigState>()((set, get) => ({
136139
COMPLEX_FLAGS.includes(key as (typeof COMPLEX_FLAGS)[number])
137140
) {
138141
const complexKey = key as keyof ComplexFeatureFlags;
139-
const enabled = variant.value === "on";
142+
const enabled = ON_VARIANT_VALUES.includes(variant.value);
140143
const flagValue = {
141144
enabled,
142145
payload: enabled ? variant.payload : undefined,

0 commit comments

Comments
 (0)