From 54180b1479279b33facd5a615f3d451b6d524ec5 Mon Sep 17 00:00:00 2001 From: eli-d <64763513+eli-d@users.noreply.github.com> Date: Wed, 27 Nov 2024 15:34:26 +1030 Subject: [PATCH] don't override feature flags if not explicitly set --- web/src/hooks/useFeatureFlag.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/src/hooks/useFeatureFlag.tsx b/web/src/hooks/useFeatureFlag.tsx index 54482712..270a9538 100644 --- a/web/src/hooks/useFeatureFlag.tsx +++ b/web/src/hooks/useFeatureFlag.tsx @@ -201,7 +201,9 @@ export const useFeatureFlag = ( */ return useMemo(() => { if (skipOverride) return data?.[featureFlag]; - if (override) return featureFlagOverride[featureFlag]; + // if override isn't set for this flag, use the existing value + if (override && featureFlagOverride[featureFlag] !== undefined) + return featureFlagOverride[featureFlag]; return data?.[featureFlag]; }, [skipOverride, override, featureFlagOverride, data, featureFlag]); };