From 794d9d84ca012b50cc921e2cf29b911271b85174 Mon Sep 17 00:00:00 2001
From: Jorik Schellekens <joriksch@gmail.com>
Date: Wed, 16 Sep 2020 14:57:48 +0100
Subject: [PATCH] hacky fix infinite loop

---
 src/App.tsx | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/App.tsx b/src/App.tsx
index 164190c..376f7b6 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -36,13 +36,18 @@ const App: React.FC = () => {
         </>
     );
 
-    // Some hacky uri decoding
-    location.href = decodeURIComponent(location.href);
-
     const [hash, setHash] = useState(location.hash);
 
     console.log(hash);
-    useEffect(() => (window.onhashchange = () => setHash(location.hash)), []);
+    useEffect(() => {
+        // Some hacky uri decoding
+        if (location.href.split('/').length > 4) {
+            location.href = decodeURIComponent(location.href);
+        }
+
+        window.onhashchange = () => setHash(location.hash);
+        console.log('why');
+    }, []);
 
     if (hash) {
         if (hash.startsWith('#/')) {
-- 
GitLab