Skip to content
This repository has been archived by the owner on Jun 2, 2022. It is now read-only.

Commit

Permalink
Update FeatureToggle component types (LedgerHQ#1737)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasrogerlux authored and aimxhaisse committed Mar 5, 2022
1 parent 6d34e73 commit ff681ea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ src/hw @ledgerhq/live-devices
src/manager @ledgerhq/live-devices
src/apps @ledgerhq/live-devices
src/notifications @ledgerhq/live-hub
src/featureFlags @ledgerhq/live-hub
src/exchange @ledgerhq/live-platform-and-services
src/platform @ledgerhq/live-platform-and-services
8 changes: 4 additions & 4 deletions src/featureFlags/FeatureToggle.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReactNode } from "react";
import React, { ReactNode } from "react";

import useFeature from "./useFeature";
import { FeatureId } from "./types";
Expand All @@ -13,12 +13,12 @@ export const FeatureToggle = ({
feature: featureId,
fallback,
children,
}: Props): ReactNode => {
}: Props): JSX.Element => {
const feature = useFeature(featureId);

if (!feature || !feature.enabled) {
return fallback ?? null;
return <>{fallback || null}</>;
}

return children ?? null;
return <>{children || null}</>;
};

0 comments on commit ff681ea

Please sign in to comment.