From be0baa7b7ab4d4c773e1328f055b3dadba44a175 Mon Sep 17 00:00:00 2001
From: gcarron <gcarron@grandlyon.com>
Date: Tue, 28 Jun 2022 10:07:01 +0200
Subject: [PATCH] fix(ecogesture): Reload on single ecogesture won't make the
 app crash anymore

---
 src/components/Ecogesture/SingleEcogesture.tsx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/components/Ecogesture/SingleEcogesture.tsx b/src/components/Ecogesture/SingleEcogesture.tsx
index 569404018..9267cccc3 100644
--- a/src/components/Ecogesture/SingleEcogesture.tsx
+++ b/src/components/Ecogesture/SingleEcogesture.tsx
@@ -44,7 +44,8 @@ const SingleEcogesture: React.FC<SingleEcogestureProps> = ({
   const [isObjective, setIsObjective] = useState<boolean>(false)
   const [isLoading, setIsLoading] = useState<boolean>(true)
   const ecogestureID: string = match.params.id
-  const selectionCompleted = location.state.selectionCompleted
+  const selectionCompleted =
+    location && location.state && location.state.selectionCompleted
 
   const ecogestureService = useMemo(() => new EcogestureService(client), [
     client,
-- 
GitLab