From 2497acdbcc523d2d3e3f82d0ba92723e609eb57c Mon Sep 17 00:00:00 2001 From: FifthWit Date: Thu, 30 Jan 2025 11:10:23 -0600 Subject: removed a lot of unused vars and missing deps, some are set but not read so I just ignored it since I dont want to deal with it --- frontend/src/pages/Maplist.tsx | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'frontend') diff --git a/frontend/src/pages/Maplist.tsx b/frontend/src/pages/Maplist.tsx index 5138964..372b800 100644 --- a/frontend/src/pages/Maplist.tsx +++ b/frontend/src/pages/Maplist.tsx @@ -11,7 +11,6 @@ const Maplist: React.FC = () => { const [game, setGame] = React.useState(null); const [catNum, setCatNum] = React.useState(0); const [id, setId] = React.useState(0); - const [category, setCategory] = React.useState(0); const [load, setLoad] = React.useState(false); const [currentlySelected, setCurrentlySelected] = React.useState(0); const [hasClicked, setHasClicked] = React.useState(false); @@ -37,7 +36,7 @@ const Maplist: React.FC = () => { }; const _handle_dropdown_click = () => { - if (dropdownActive == 'none') { + if (dropdownActive === 'none') { setDropdownActive('block'); } else { setDropdownActive('none'); @@ -54,7 +53,7 @@ const Maplist: React.FC = () => { const queryParams = new URLSearchParams(location.search); if (queryParams.get('chapter')) { let cat = parseFloat(queryParams.get('chapter') || ''); - if (gameId == 2) { + if (gameId === 2) { cat += 10; } _fetch_chapters(cat.toString()); @@ -79,14 +78,14 @@ const Maplist: React.FC = () => { setLoad(true); _fetch_game(); _fetch_game_chapters(); - }, []); + }, [location.search]); useEffect(() => { const queryParams = new URLSearchParams(location.search); - if (gameChapters != undefined && !queryParams.get('chapter')) { + if (gameChapters !== undefined && !queryParams.get('chapter')) { _fetch_chapters(gameChapters!.chapters[0].id.toString()); } - }, [gameChapters]); + }, [gameChapters, location.search]); return (
@@ -126,8 +125,8 @@ const Maplist: React.FC = () => {