Skip to content

Commit

Permalink
don't override feature flags if not explicitly set
Browse files Browse the repository at this point in the history
  • Loading branch information
eli-d committed Nov 27, 2024
1 parent 963ed97 commit 54180b1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion web/src/hooks/useFeatureFlag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ export const useFeatureFlag = <T extends keyof FeatureFlags>(
*/
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]);
};

0 comments on commit 54180b1

Please sign in to comment.