From ff681ea67d10e23b3d6c93b144938a93d77e1a07 Mon Sep 17 00:00:00 2001 From: Thomas Roger Lux Date: Thu, 24 Feb 2022 12:24:46 +0100 Subject: [PATCH] Update FeatureToggle component types (#1737) --- CODEOWNERS | 1 + src/featureFlags/FeatureToggle.tsx | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index 403f5b5949..222ebfae9b 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -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 \ No newline at end of file diff --git a/src/featureFlags/FeatureToggle.tsx b/src/featureFlags/FeatureToggle.tsx index 0fbe8ca6ac..c9ce7f6835 100644 --- a/src/featureFlags/FeatureToggle.tsx +++ b/src/featureFlags/FeatureToggle.tsx @@ -1,4 +1,4 @@ -import { ReactNode } from "react"; +import React, { ReactNode } from "react"; import useFeature from "./useFeature"; import { FeatureId } from "./types"; @@ -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}; };