From 12bc8f1f0f79e6906a80b304a75d662265b6919c Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sun, 5 Feb 2023 13:22:23 -0800 Subject: [PATCH] Fix #234 This makes sure we fetch profiles when the username changes in the router, and also update the fetchProfile callback as well --- pages/[username].tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pages/[username].tsx b/pages/[username].tsx index fbe090e9..e0626e04 100644 --- a/pages/[username].tsx +++ b/pages/[username].tsx @@ -21,6 +21,7 @@ import ErrorSection from '~components/ErrorSection' import FilterBar from '~components/FilterBar' import ProfileHead from '~components/ProfileHead' +import type { AxiosError } from 'axios' import type { NextApiRequest, NextApiResponse } from 'next' import type { FilterObject, @@ -28,7 +29,6 @@ import type { PaginationObject, ResponseStatus, } from '~types' -import { AxiosError } from 'axios' interface Props { context?: PageContextObj @@ -160,7 +160,7 @@ const ProfileRoute: React.FC = ({ .catch((error) => handleError(error)) } }, - [currentPage, parties, element, raid, recency] + [currentPage, username, parties, element, raid, recency] ) function replaceResults(count: number, list: Party[]) { @@ -194,7 +194,7 @@ const ProfileRoute: React.FC = ({ useDidMountEffect(() => { setCurrentPage(1) fetchProfile({ replace: true }) - }, [element, raid, recency]) + }, [username, element, raid, recency]) // When the page changes, fetch all teams again. useDidMountEffect(() => {