Skip to content

Commit

Permalink
🐛Fix: ProfilePage 깜빡임
Browse files Browse the repository at this point in the history
  • Loading branch information
shlee9999 committed Dec 4, 2024
1 parent 0a61c61 commit 25e84d5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/apis/member/useFetchProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export const useFetchProfile = (memberId: number): UseQueryResult<FetchProfileRe
queryKey: ['profile', memberId],
queryFn: () => fetchProfile({ memberId }).then(data => data.data),
enabled: !!memberId,
staleTime: 1000 * 60 * 5, // 5분
})
}
3 changes: 2 additions & 1 deletion src/pages/ProfilePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 <div>isFetching</div>
if (isLoading) return <Loader />
if (isError) return <div>Error fetching profile</div>

Expand Down
3 changes: 2 additions & 1 deletion src/stores/modalStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const useModalStore = create<ModalStore>((set, get) => ({
clearModal: () => {
set({ modalList: [] })
// 모든 모달 제거 시 히스토리 초기화
window.history.go(-get().modalList.length)
const modalCount = get().modalList.length
if (modalCount) window.history.go(-modalCount)
},
}))

0 comments on commit 25e84d5

Please sign in to comment.