From 8bffd2984e51a342e5ef6070b1d1398157d64ded Mon Sep 17 00:00:00 2001 From: louis Date: Sun, 9 Oct 2022 15:57:55 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=20Make=20FeatureContext=20work=20w?= =?UTF-8?q?hen=20unauthenticated?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/useFeature.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/useFeature.tsx b/src/components/useFeature.tsx index f1740af7..fbb72ec6 100644 --- a/src/components/useFeature.tsx +++ b/src/components/useFeature.tsx @@ -27,11 +27,13 @@ export function FeatureProvider({ const { getFeatures } = useFeatureApi(token) useEffect(() => { - getFeatures().then(response => { - setFeatures(response.data.features) - - setLoadingInitial(false) - }) + getFeatures() + .then(response => { + setFeatures(response.data.features) + }) + .finally(() => { + setLoadingInitial(false) + }) // eslint-disable-next-line react-hooks/exhaustive-deps }, [])