diff options
| author | FifthWit <fifthwitbusiness@gmail.com> | 2025-01-30 11:17:02 -0600 |
|---|---|---|
| committer | FifthWit <fifthwitbusiness@gmail.com> | 2025-01-30 11:17:02 -0600 |
| commit | 1fc303a142ce06358dff23c2a1bea08e8fdf442f (patch) | |
| tree | 8f047e6e01efd730c711fe01b96421c36c9fb484 | |
| parent | fixed missing useEffect deps (diff) | |
| download | lphub-1fc303a142ce06358dff23c2a1bea08e8fdf442f.tar.gz lphub-1fc303a142ce06358dff23c2a1bea08e8fdf442f.tar.bz2 lphub-1fc303a142ce06358dff23c2a1bea08e8fdf442f.zip | |
forgot to add useCallback
| -rw-r--r-- | frontend/src/pages/Profile.tsx | 8 |
1 files changed, 4 insertions, 4 deletions
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<ProfileProps> = ({ | |||
| 61 | } | 61 | } |
| 62 | }; | 62 | }; |
| 63 | 63 | ||
| 64 | const _get_game_chapters = async () => { | 64 | const _get_game_chapters = React.useCallback(async () => { |
| 65 | if (game && game !== '0') { | 65 | if (game && game !== '0') { |
| 66 | const gameChapters = await API.get_games_chapters(game); | 66 | const gameChapters = await API.get_games_chapters(game); |
| 67 | setChapterData(gameChapters); | 67 | setChapterData(gameChapters); |
| @@ -69,9 +69,9 @@ const Profile: React.FC<ProfileProps> = ({ | |||
| 69 | setPageMax(Math.ceil(profile!.records.length / 20)); | 69 | setPageMax(Math.ceil(profile!.records.length / 20)); |
| 70 | setPageNumber(1); | 70 | setPageNumber(1); |
| 71 | } | 71 | } |
| 72 | }; | 72 | }, [game, profile]); |
| 73 | 73 | ||
| 74 | const _get_game_maps = async () => { | 74 | const _get_game_maps = React.useCallback(async () => { |
| 75 | if (chapter === '0') { | 75 | if (chapter === '0') { |
| 76 | const gameMaps = await API.get_game_maps(game); | 76 | const gameMaps = await API.get_game_maps(game); |
| 77 | setMaps(gameMaps); | 77 | setMaps(gameMaps); |
| @@ -83,7 +83,7 @@ const Profile: React.FC<ProfileProps> = ({ | |||
| 83 | setPageMax(Math.ceil(gameChapters.maps.length / 20)); | 83 | setPageMax(Math.ceil(gameChapters.maps.length / 20)); |
| 84 | setPageNumber(1); | 84 | setPageNumber(1); |
| 85 | } | 85 | } |
| 86 | }; | 86 | }, [chapter, game]); |
| 87 | 87 | ||
| 88 | const _delete_submission = async (map_id: number, record_id: number) => { | 88 | const _delete_submission = async (map_id: number, record_id: number) => { |
| 89 | const userConfirmed = await confirm( | 89 | const userConfirmed = await confirm( |