Skip to content

Commit

Permalink
feat: disable hiding the feature flags panel from the feature flags p…
Browse files Browse the repository at this point in the history
…anel
  • Loading branch information
aidankinzett committed May 21, 2024
1 parent 7051946 commit c8a6847
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 1 addition & 2 deletions web/src/app/_layout/FeatureFlagConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { cn } from "@/lib/utils";
const featureFlagsLabels: { key: keyof FeatureFlags; label: string }[] = [
{ key: "ui show demo data", label: "UI Show Demo Data" },
{ key: "ui show manual fees", label: "UI Show Manual Fees" },
{ key: "ui show feature flags panel", label: "UI Show Feature Flags Panel" },
{ key: "ui show superloop", label: "UI Show Superloop" },
{ key: "ui show fee tier", label: "UI Show Fee Tier" },
{
Expand All @@ -40,7 +39,7 @@ export const FeatureFlagConfig = () => {
});

const showFeatureFlagsPanel =
useFeatureFlag("ui show feature flags panel") ||
useFeatureFlag("ui show feature flags panel", true) ||
process.env.NODE_ENV === "development";

if (!showFeatureFlagsPanel) return null;
Expand Down
2 changes: 2 additions & 0 deletions web/src/hooks/useFeatureFlag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export interface FeatureFlags {
*/
export const useFeatureFlag = <T extends keyof FeatureFlags>(
featureFlag: T,
skipOverride = false,
): FeatureFlags[T] => {
const override = useFeatureFlagOverride((s) => s.override);
const featureFlagOverride = useFeatureFlagOverride((s) => s.featureFlags);
Expand All @@ -79,6 +80,7 @@ export const useFeatureFlag = <T extends keyof FeatureFlags>(
* Otherwise, return the value from the API.
*/
return useMemo(() => {
if (skipOverride) return data?.[featureFlag];
if (override) return featureFlagOverride[featureFlag];
return data?.[featureFlag];
}, [override, featureFlagOverride, data, featureFlag]);
Expand Down

0 comments on commit c8a6847

Please sign in to comment.