diff --git a/src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/_components/ActivityPostSection/index.tsx b/src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/_components/ActivityPostSection/index.tsx
new file mode 100644
index 0000000..124d149
--- /dev/null
+++ b/src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/_components/ActivityPostSection/index.tsx
@@ -0,0 +1,53 @@
+import { useEffect } from 'react'
+
+import { useSearchParams } from 'next/navigation'
+
+import { PaginationButtons } from '@/components/PaginationButtons'
+import { PostTable } from '@/components/Table/PostTable'
+import { queryClient } from '@/service/components/ReactQueryClientProvider'
+import { useGetActivityPostsPaging } from '@/service/data/post'
+import { getActivityPostsPaging } from '@/service/server/post'
+
+type ActivityPostSectionProps = {
+ boardId: number
+}
+
+export const ActivityPostSection = ({ boardId }: ActivityPostSectionProps) => {
+ const searchParams = useSearchParams()
+ const params = new URLSearchParams(searchParams)
+
+ const page =
+ Number(params.get('page')) > 0 ? Number(params.get('page')) - 1 : 0
+
+ const { data, status, isPlaceholderData } = useGetActivityPostsPaging({
+ boardId,
+ page,
+ })
+
+ useEffect(() => {
+ if (!isPlaceholderData && data?.nextPageToken) {
+ queryClient.prefetchQuery({
+ queryKey: ['posts', boardId, page],
+ queryFn: () => getActivityPostsPaging({ boardId, page }),
+ })
+ }
+ }, [data, isPlaceholderData, page, queryClient])
+
+ if (status === 'pending')
+ return
loading...
+
+ if (!data) {
+ return
게시글이 없습니다.
+ }
+
+ return (
+
+ )
+}
diff --git a/src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/_components/BoardContent/index.tsx b/src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/_components/BoardContent/index.tsx
deleted file mode 100644
index a45c2ef..0000000
--- a/src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/_components/BoardContent/index.tsx
+++ /dev/null
@@ -1,28 +0,0 @@
-'use client'
-
-import { useBoardDetail } from '@/service/data/boards'
-
-import { BoardHero } from './BoardHero'
-import { CreatePostButton } from './CreatePostButton'
-
-type BoardPageProps = {
- boardId: number
- activityId: number
-}
-
-export const BoardContent = ({ boardId, activityId }: BoardPageProps) => {
- const { data: boardDetail, status } = useBoardDetail({
- activityId,
- boardId,
- })
-
- if (status === 'pending') return
loading...
- if (!boardDetail) return
게시판 정보가 없습니다.
-
- return (
-
-
-
-
- )
-}
diff --git a/src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/_components/BoardContent/BoardHero/BoardDetail/index.tsx b/src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/_components/BoardHero/BoardDetail/index.tsx
similarity index 100%
rename from src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/_components/BoardContent/BoardHero/BoardDetail/index.tsx
rename to src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/_components/BoardHero/BoardDetail/index.tsx
diff --git a/src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/_components/BoardContent/BoardHero/index.tsx b/src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/_components/BoardHero/index.tsx
similarity index 100%
rename from src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/_components/BoardContent/BoardHero/index.tsx
rename to src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/_components/BoardHero/index.tsx
diff --git a/src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/_components/BoardContent/CreatePostButton/index.tsx b/src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/_components/CreatePostButton/index.tsx
similarity index 100%
rename from src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/_components/BoardContent/CreatePostButton/index.tsx
rename to src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/_components/CreatePostButton/index.tsx
diff --git a/src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/create-post/_components/CreateActivityPostForm/index.tsx b/src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/create-post/_components/CreateActivityPostForm/index.tsx
index 0ba02b7..bbe5666 100644
--- a/src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/create-post/_components/CreateActivityPostForm/index.tsx
+++ b/src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/create-post/_components/CreateActivityPostForm/index.tsx
@@ -10,6 +10,7 @@ import { usePathname, useRouter } from 'next/navigation'
import { CreatePostForm } from '@/components/CreatePostForm'
import { useToast } from '@/components/ui/use-toast'
import { CreateActivityPost, CreateActivityPostSchema } from '@/schema/post'
+import { queryClient } from '@/service/components/ReactQueryClientProvider'
import { createActivityPostAction } from '@/service/server/post/create-post'
type CreateActivityPostFormProps = {
@@ -51,7 +52,9 @@ export const CreateActivityPostForm = ({
title: result.data.message,
duration: 3000,
})
+ queryClient.invalidateQueries({ queryKey: ['posts', boardId, 0] })
router.push(basePath)
+
return
}
diff --git a/src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/page.tsx b/src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/page.tsx
index e05c0da..b994e8b 100644
--- a/src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/page.tsx
+++ b/src/app/(main)/activity/[semesterName]/[activityId]/boards/[boardId]/page.tsx
@@ -1,6 +1,10 @@
'use client'
-import { BoardContent } from './_components/BoardContent'
+import { useBoardDetail } from '@/service/data/boards'
+
+import { ActivityPostSection } from './_components/ActivityPostSection'
+import { BoardHero } from './_components/BoardHero'
+import { CreatePostButton } from './_components/CreatePostButton'
type BoardPageParams = {
params: {
@@ -10,11 +14,20 @@ type BoardPageParams = {
}
const BoardPage = ({ params }: BoardPageParams) => {
+ const { data: boardDetail, status } = useBoardDetail({
+ activityId: Number(params.activityId),
+ boardId: Number(params.boardId),
+ })
+
+ if (status === 'pending') return
loading...
+ if (!boardDetail) return
게시판 정보가 없습니다.
+
return (
-
+
)
}
diff --git a/src/app/(main)/activity/[semesterName]/[activityId]/layout.tsx b/src/app/(main)/activity/[semesterName]/[activityId]/layout.tsx
index 4cd1f31..03f5b08 100644
--- a/src/app/(main)/activity/[semesterName]/[activityId]/layout.tsx
+++ b/src/app/(main)/activity/[semesterName]/[activityId]/layout.tsx
@@ -8,7 +8,9 @@ const ActivityLayout = ({ children }: { children: ReactNode }) => {
return (
loading... }
+ suspenseFallback={
+ loading...
+ }
>
{children}
diff --git a/src/app/(main)/event/board/_components/EventPostSection/index.tsx b/src/app/(main)/event/board/_components/EventPostSection/index.tsx
index b6172d4..87938da 100644
--- a/src/app/(main)/event/board/_components/EventPostSection/index.tsx
+++ b/src/app/(main)/event/board/_components/EventPostSection/index.tsx
@@ -4,13 +4,12 @@ import { useEffect } from 'react'
import { useSearchParams } from 'next/navigation'
-import { TablePaginationButton } from '@/components/Table/TablePaginationButton'
+import { PaginationButtons } from '@/components/PaginationButtons'
+import { PostTable } from '@/components/Table/PostTable'
import { queryClient } from '@/service/components/ReactQueryClientProvider'
import { useGetPostsPaging } from '@/service/data/post'
import { getPostsPaging } from '@/service/server/post'
-import { EventPostTable } from './EventPostTable'
-
export const EventPostSection = () => {
const postType = 'EVENT'
@@ -43,12 +42,12 @@ export const EventPostSection = () => {
return (