From 68199e1b39bd2b9d4c07379f453e7d0d42c53c18 Mon Sep 17 00:00:00 2001
From: FifthWit <fifthwitbusiness@gmail.com>
Date: Thu, 30 Jan 2025 11:12:46 -0600
Subject: fixed useEffect deps

---
 frontend/src/pages/Maps.tsx | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

(limited to 'frontend/src/pages/Maps.tsx')

diff --git a/frontend/src/pages/Maps.tsx b/frontend/src/pages/Maps.tsx
index 51a2020..33bd05b 100644
--- a/frontend/src/pages/Maps.tsx
+++ b/frontend/src/pages/Maps.tsx
@@ -35,26 +35,31 @@ const Maps: React.FC<MapProps> = ({ token, isModerator }) => {
 
   const mapID = location.pathname.split('/')[2];
 
-  const _fetch_map_summary = async () => {
+  const _fetch_map_summary = React.useCallback(async () => {
     const mapSummary = await API.get_map_summary(mapID);
     setMapSummaryData(mapSummary);
-  };
+  }, [mapID]);
 
-  const _fetch_map_leaderboards = async () => {
+  const _fetch_map_leaderboards = React.useCallback(async () => {
     const mapLeaderboards = await API.get_map_leaderboard(mapID, '1');
     setMapLeaderboardData(mapLeaderboards);
-  };
+  }, [mapID]);
 
-  const _fetch_map_discussions = async () => {
+  const _fetch_map_discussions = React.useCallback(async () => {
     const mapDiscussions = await API.get_map_discussions(mapID);
     setMapDiscussionsData(mapDiscussions);
-  };
+  }, [mapID]);
 
   React.useEffect(() => {
     _fetch_map_summary();
     _fetch_map_leaderboards();
     _fetch_map_discussions();
-  }, [mapID]);
+  }, [
+    mapID,
+    _fetch_map_discussions,
+    _fetch_map_leaderboards,
+    _fetch_map_summary,
+  ]);
 
   if (!mapSummaryData) {
     // loading placeholder
-- 
cgit v1.2.3

