diff --git a/src/app/template.tsx b/src/app/template.tsx index 062365f9..fd06b58c 100644 --- a/src/app/template.tsx +++ b/src/app/template.tsx @@ -9,6 +9,7 @@ import { CategoryBottomSheet } from './toks-main/components/CategoryBottomSheet' export default function Template({ children }: StrictPropsWithChildren) { // TODO: useAuth hook 구현 // TODO: useLogin Modal hook 구현 + // TODO: GlobalPortal 제거 const pathName = usePathname(); return ( diff --git a/src/app/toks-main/components/MainPageSlider/SkeletonSlider.tsx b/src/app/toks-main/components/MainPageSlider/SkeletonSlider.tsx index 57803fbb..86218151 100644 --- a/src/app/toks-main/components/MainPageSlider/SkeletonSlider.tsx +++ b/src/app/toks-main/components/MainPageSlider/SkeletonSlider.tsx @@ -1,3 +1,5 @@ export const SkeletonSlider = () => { - return
; + return ( +
+ ); }; diff --git a/src/app/toks-main/components/MainPageSlider/index.tsx b/src/app/toks-main/components/MainPageSlider/index.tsx index 2c1252af..a24f6008 100644 --- a/src/app/toks-main/components/MainPageSlider/index.tsx +++ b/src/app/toks-main/components/MainPageSlider/index.tsx @@ -1,13 +1,17 @@ -'use client'; -import { useSuspenseQuery } from '@tanstack/react-query'; +import { useQuery } from '@tanstack/react-query'; import { NoticeSlider } from '@/common'; +import { SkeletonSlider } from './SkeletonSlider'; import { QUERY_KEYS } from '../../constants/queryKeys'; import { getNotices } from '../../remotes/notice'; export const MainPageSlider = () => { - const { data: notices } = useSuspenseQuery({ + const { + data: notices, + isLoading, + isSuccess, + } = useQuery({ queryKey: [QUERY_KEYS.GET_NOTICES], queryFn: async () => { try { @@ -18,9 +22,16 @@ export const MainPageSlider = () => { }, }); - const imageInfo = notices.bottomBanners.map((el) => { - return { imageUrl: el.imageUrl, landingUrl: el.landingUrl }; - }); + if (isLoading) { + return ; + } + + if (isSuccess) { + const imageInfo = notices.bottomBanners.map((el) => { + return { imageUrl: el.imageUrl, landingUrl: el.landingUrl }; + }); + return ; + } - return ; + return null; }; diff --git a/src/app/toks-main/page.tsx b/src/app/toks-main/page.tsx index e2d3521e..f739b00d 100644 --- a/src/app/toks-main/page.tsx +++ b/src/app/toks-main/page.tsx @@ -2,14 +2,13 @@ import { useEffect, useState } from 'react'; import { useRecoilState } from 'recoil'; -import { FloatingButton, SSRSuspense, Toast, ToastProps } from '@/common'; +import { FloatingButton, Toast, ToastProps } from '@/common'; import { useToast } from '@/common/hooks'; import { isVisibleFloatingButtonBottomSheetAtom } from '@/store'; import { CardList } from './components/CardList'; import { MainPageBottomSheet } from './components/MainPageBottomSheet'; import { MainPageSlider } from './components/MainPageSlider'; -import { SkeletonSlider } from './components/MainPageSlider/SkeletonSlider'; function ToksMainPage() { const { getSavedToastInfo, clearSavedToast } = useToast(); @@ -34,9 +33,7 @@ function ToksMainPage() { title={toastData.title} /> )} - }> - - +