From 25e84d587e285f36bf21097efd2f84c200c127af Mon Sep 17 00:00:00 2001 From: shlee9999 <95556588+shlee9999@users.noreply.github.com> Date: Wed, 4 Dec 2024 18:01:50 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9BFix:=20ProfilePage=20=EA=B9=9C?= =?UTF-8?q?=EB=B9=A1=EC=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/member/useFetchProfile.tsx | 1 + src/pages/ProfilePage/index.tsx | 3 ++- src/stores/modalStore.ts | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/apis/member/useFetchProfile.tsx b/src/apis/member/useFetchProfile.tsx index b1be787..6808626 100644 --- a/src/apis/member/useFetchProfile.tsx +++ b/src/apis/member/useFetchProfile.tsx @@ -6,5 +6,6 @@ export const useFetchProfile = (memberId: number): UseQueryResult fetchProfile({ memberId }).then(data => data.data), enabled: !!memberId, + staleTime: 1000 * 60 * 5, // 5분 }) } diff --git a/src/pages/ProfilePage/index.tsx b/src/pages/ProfilePage/index.tsx index 935f2ae..92d684d 100644 --- a/src/pages/ProfilePage/index.tsx +++ b/src/pages/ProfilePage/index.tsx @@ -12,8 +12,9 @@ export default function ProfilePage() { const { id = '0' } = useParams() const navigate = useNavigate() - const { data, isLoading, isError } = useFetchProfile(+id) + const { data, isLoading, isError, isFetching } = useFetchProfile(+id) + if (isFetching) return
isFetching
if (isLoading) return if (isError) return
Error fetching profile
diff --git a/src/stores/modalStore.ts b/src/stores/modalStore.ts index 7c86205..c256267 100644 --- a/src/stores/modalStore.ts +++ b/src/stores/modalStore.ts @@ -31,6 +31,7 @@ export const useModalStore = create((set, get) => ({ clearModal: () => { set({ modalList: [] }) // 모든 모달 제거 시 히스토리 초기화 - window.history.go(-get().modalList.length) + const modalCount = get().modalList.length + if (modalCount) window.history.go(-modalCount) }, }))