From ce0aba2685f5d491da69a4a6f194e938f9cacaac Mon Sep 17 00:00:00 2001
From: esikkala <esko.ikkala@aalto.fi>
Date: Mon, 24 Jan 2022 18:20:23 +0200
Subject: [PATCH] Deactivate tabs properly

---
 src/client/components/main_layout/PerspectiveTabs.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/client/components/main_layout/PerspectiveTabs.js b/src/client/components/main_layout/PerspectiveTabs.js
index d9538c1e..075d5005 100644
--- a/src/client/components/main_layout/PerspectiveTabs.js
+++ b/src/client/components/main_layout/PerspectiveTabs.js
@@ -35,6 +35,7 @@ const PerspectiveTabs = props => {
       // "MUI: The `value` provided to the Tabs component is invalid.
       // The Tab with this `value` ("0") is not part of the document layout.
       // Make sure the tab item is present in the document or that it's not `display: none`.""
+      // https://github.com/mui-org/material-ui/issues/29209
       const timer = setTimeout(() => setCurrentTab(pathnameToTabValue(location, tabs)), 1000)
 
       // clear timeout when component unmounts
@@ -45,8 +46,9 @@ const PerspectiveTabs = props => {
     [location]
   )
 
+  // always deactivate tabs, until the useEffect hook sets the value
   const handleChange = (event, newValue) => {
-    setCurrentTab(newValue)
+    setCurrentTab(false)
   }
 
   return (
-- 
GitLab