From 1fc303a142ce06358dff23c2a1bea08e8fdf442f Mon Sep 17 00:00:00 2001 From: FifthWit Date: Thu, 30 Jan 2025 11:17:02 -0600 Subject: forgot to add useCallback --- frontend/src/pages/Profile.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'frontend/src/pages') diff --git a/frontend/src/pages/Profile.tsx b/frontend/src/pages/Profile.tsx index 127eb04..2533291 100644 --- a/frontend/src/pages/Profile.tsx +++ b/frontend/src/pages/Profile.tsx @@ -61,7 +61,7 @@ const Profile: React.FC = ({ } }; - const _get_game_chapters = async () => { + const _get_game_chapters = React.useCallback(async () => { if (game && game !== '0') { const gameChapters = await API.get_games_chapters(game); setChapterData(gameChapters); @@ -69,9 +69,9 @@ const Profile: React.FC = ({ setPageMax(Math.ceil(profile!.records.length / 20)); setPageNumber(1); } - }; + }, [game, profile]); - const _get_game_maps = async () => { + const _get_game_maps = React.useCallback(async () => { if (chapter === '0') { const gameMaps = await API.get_game_maps(game); setMaps(gameMaps); @@ -83,7 +83,7 @@ const Profile: React.FC = ({ setPageMax(Math.ceil(gameChapters.maps.length / 20)); setPageNumber(1); } - }; + }, [chapter, game]); const _delete_submission = async (map_id: number, record_id: number) => { const userConfirmed = await confirm( -- cgit v1.2.3