diff --git a/src/app/detail/[postingId]/page.tsx b/src/app/detail/[postingId]/page.tsx index fea3fddd..402cc2d8 100644 --- a/src/app/detail/[postingId]/page.tsx +++ b/src/app/detail/[postingId]/page.tsx @@ -1,32 +1,29 @@ -"use client"; - -import { useParams } from "next/navigation"; -import { useQuery } from "@tanstack/react-query"; +import { + QueryClient, + dehydrate, + HydrationBoundary, +} from "@tanstack/react-query"; import { getPostDetail } from "@/entities/post/api/getPostDetail"; -import { PostDetailSection } from "@/widgets/postDetail/ui/PostDetailSection"; -import { SellerPostsSection } from "@/widgets/postDetail/ui/SellerPostsSection"; +import PostDetailPageClient from "@/widgets/postDetail/ui/DetailPage.client"; -export default function PostDetailPage() { - const { postingId } = useParams<{ postingId: string }>(); +export default async function Page({ + params, +}: { + params: { postingId: string }; +}) { + const { postingId } = params; const id = Number(postingId); + const queryClient = new QueryClient(); - const { - data: post, - isLoading, - isError, - } = useQuery({ + await queryClient.prefetchQuery({ queryKey: ["postDetail", id], queryFn: () => getPostDetail(id), + staleTime: Infinity, }); - if (isLoading) return

로딩 중...

; - if (isError || !post) - return

게시글을 찾을 수 없습니다.

; - return ( -
- - -
+ + + ); } diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 34caac0e..cfbb2e30 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -6,7 +6,6 @@ import Header from "@/widgets/header/ui/Header"; import { ModalContainer } from "@/shared/ui/ModalContainer/ModalContainer"; import ChatContainer from "@/features/chat/ui/ChatContainer"; import { ReactQueryProvider } from "@/shared/lib/provider"; -import { ClientLayout } from "@/shared/lib/ClientLayout"; const myFont = localFont({ src: "../shared/fonts/PretendardVariable.woff2", @@ -24,29 +23,23 @@ export default function RootLayout({ }) { return ( - + - - -
- + +
+ - Loading...} - > - {children} - + {children} -