diff --git a/apps/web/app/admin/banners/page.tsx b/apps/web/app/admin/banners/page.tsx index 6eee4c54e..e1259f314 100644 --- a/apps/web/app/admin/banners/page.tsx +++ b/apps/web/app/admin/banners/page.tsx @@ -2,6 +2,7 @@ import { useState, useRef, useMemo, Suspense, useEffect, useLayoutEffect } from 'react'; import { useFilledSkeletonCount } from '@/lib/use-filled-skeleton-count'; +import { useInitialLoadPending } from '@/lib/use-initial-load-pending'; import Image from 'next/image'; import { useRouter } from 'next/navigation'; import { useAuth } from '@/contexts/AuthContext'; @@ -148,13 +149,12 @@ function BannerManagementPage({ embedded, onInitialContentReady }: BannerManagem // 배너 데이터 const { data: banners = [], isLoading: bannersLoading } = useAdBannersAdmin(); - const initialLoadPendingRef = useRef(true); - if (initialLoadPendingRef.current && !authLoading && !bannersLoading) initialLoadPendingRef.current = false; + const initialLoadPending = useInitialLoadPending(!authLoading && !bannersLoading); useLayoutEffect(() => { - if (!onInitialContentReady || authLoading || initialLoadPendingRef.current) return; + if (!onInitialContentReady || authLoading || initialLoadPending) return; onInitialContentReady(); - }, [authLoading, bannersLoading, onInitialContentReady]); - const bannerListSkeleton = useFilledSkeletonCount(88, 5); + }, [authLoading, bannersLoading, initialLoadPending, onInitialContentReady]); + const { ref: bannerListRef, count: bannerListCount } = useFilledSkeletonCount(88, 5); const createBanner = useCreateAdBanner(); const updateBanner = useUpdateAdBanner(); const deleteBanner = useDeleteAdBanner(); @@ -602,11 +602,11 @@ function BannerManagementPage({ embedded, onInitialContentReady }: BannerManagem -