Skip to content

Commit

Permalink
[#612] 북카이브 페이지에서 발생하는 무한 리랜더링 버그 수정 (#613)
Browse files Browse the repository at this point in the history
- fix: 로그인상태 북카이브 페이지에서 유효하지 않은 accessToken으로 변경시 무한 리랜더링 되던 현상 수정
  • Loading branch information
hanyugeon authored Jun 7, 2024
1 parent 5af75fd commit a417f47
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/app/bookarchive/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
'use client';

import useMyProfileQuery from '@/queries/user/useMyProfileQuery';

import { checkAuthentication } from '@/utils/helpers';
import { Suspense } from 'react';
import useMounted from '@/hooks/useMounted';

import SSRSafeSuspense from '@/components/SSRSafeSuspense';
import BookArchiveForAuth from '@/v1/bookArchive/BookArchiveForAuth';
import BookArchiveForUnAuth from '@/v1/bookArchive/BookArchiveForUnAuth';
import TopHeader from '@/v1/base/TopHeader';
Expand All @@ -13,9 +14,9 @@ export default function BookArchivePage() {
<div className="flex w-full flex-col gap-[1rem] pb-[2rem]">
<TopHeader text="BookArchive" />
{/* TODO: 스켈레톤 컴포넌트로 교체 */}
<Suspense fallback={null}>
<SSRSafeSuspense fallback={null}>
<Contents />
</Suspense>
</SSRSafeSuspense>
</div>
);
}
Expand All @@ -25,8 +26,6 @@ const Contents = () => {
const { data: userData } = useMyProfileQuery({
enabled: isAuthenticated,
});
const mounted = useMounted();
if (!mounted) return null;

return isAuthenticated ? (
<BookArchiveForAuth userJobGroup={userData.job.jobGroupName} />
Expand Down

0 comments on commit a417f47

Please sign in to comment.