Skip to content

Commit

Permalink
✨ Feat(create-board): 게시판 정보 prefetch 추가
Browse files Browse the repository at this point in the history
related to: #169
  • Loading branch information
ppochaco committed Aug 14, 2024
1 parent 83f5aea commit 1f4d167
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { ReactNode } from 'react'

import {
HydrationBoundary,
QueryClient,
dehydrate,
} from '@tanstack/react-query'

import { boardDetailQuery } from '@/service/data/boards'

type CreateBoardLayoutParams = {
activityId: string
boardId: string
}

type CreateBoardLayoutProps = {
children: ReactNode
params: CreateBoardLayoutParams
}

const CreateBoardLayout = async ({
children,
params,
}: CreateBoardLayoutProps) => {
const queryClient = new QueryClient()

await queryClient.prefetchQuery(
boardDetailQuery(Number(params.activityId), Number(params.boardId)),
)

return (
<HydrationBoundary state={dehydrate(queryClient)}>
{children}
</HydrationBoundary>
)
}

export default CreateBoardLayout

0 comments on commit 1f4d167

Please sign in to comment.