Skip to content

Commit 0d47f6a

Browse files
committed
검색창에 Suspense를 감싸서 빌드 시 Prerender Error(https://nextjs.org/docs/messages/prerender-error) 뜨는거 해결(참고: https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout)
1 parent 17dd513 commit 0d47f6a

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/app/(main)/layout.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Link from "next/link";
1010
import SearchBar from "@/app/components/main-layout/search-bar";
1111
import {UserInfo} from "@/app/components/main-layout/user-info";
1212
import {Footer} from "@/app/components/main-layout/footer";
13+
import {Suspense} from "react";
1314

1415
export default async function MainLayout({children}: {children:React.ReactNode}) {
1516

@@ -43,7 +44,9 @@ export default async function MainLayout({children}: {children:React.ReactNode})
4344
<NavbarLink as={Link} href={"/survey"}>취향 설문하고 와인 추천 받기</NavbarLink>
4445
<NavbarLink as={Link} href={"/ranking"}>랭킹</NavbarLink>
4546
<li className={"max-md:my-2 md:flex-1 md:ml-8 max-md:-order-10"}>
46-
<SearchBar/>
47+
<Suspense>
48+
<SearchBar/>
49+
</Suspense>
4750
</li>
4851
</NavbarCollapse>
4952
</Navbar>

src/app/(main)/ranking/page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type {Metadata} from "next";
2-
import {SurveyForm} from "@/app/components/main-layout/survey/survey-form";
32

43
export const metadata: Metadata = {
54
title: "랭킹",

src/app/components/main-layout/search-bar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ export default function SearchBar() {
6868
}
6969

7070
return (
71-
<Suspense>
71+
<>
7272
<form action={search}>
7373
<Search />
7474
</form>
75-
</Suspense>
75+
</>
7676
)
7777
}

0 commit comments

Comments
 (0)