From 927bb1ff6ba43a42f283f0350a472c9229e69257 Mon Sep 17 00:00:00 2001 From: Pierre Ferreira Date: Fri, 15 Dec 2023 10:41:47 +0100 Subject: [PATCH] fix bug sonar 1 --- cryptide_project/src/Pages/Lobbies.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cryptide_project/src/Pages/Lobbies.tsx b/cryptide_project/src/Pages/Lobbies.tsx index 02a6195..116efa0 100644 --- a/cryptide_project/src/Pages/Lobbies.tsx +++ b/cryptide_project/src/Pages/Lobbies.tsx @@ -28,7 +28,7 @@ class LobbyDataProps { } } -let cptNavigation = 0 +// let cptNavigation = 0 function Lobbies() { const theme=useTheme(); @@ -42,6 +42,8 @@ function Lobbies() { const [showAvailable, setShowAvailable] = useState(true); + const [cptNavigation, setCptNavigation] = useState(0); + const handleShowAllClick = () => { setShowAvailable(false); }; @@ -67,7 +69,7 @@ function Lobbies() { } const navigationType = useNavigationType() - cptNavigation++ + setCptNavigation((prevCpt) => prevCpt + 1); if (cptNavigation % 2 == 0){ if (navigationType.toString() == "POP"){ socket.emit("player quit")