Skip to content

Commit a795132

Browse files
authored
Merge pull request #54 from JECT-Study/feat/35-agreement-screen
fix: wrap exhibition search params in suspense
2 parents 818cc43 + b7ce1d0 commit a795132

2 files changed

Lines changed: 54 additions & 12 deletions

File tree

src/app/exhibitions/[exhibitionId]/consent/page.tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import { use, useEffect, useMemo, useRef, useState } from "react";
3+
import { Suspense, use, useEffect, useMemo, useRef, useState } from "react";
44

55
import { useRouter, useSearchParams } from "next/navigation";
66

@@ -96,7 +96,18 @@ function ConsentPageSkeleton() {
9696
);
9797
}
9898

99-
export default function ConsentPage({ params }: ConsentPageProps) {
99+
function ConsentPageFallback() {
100+
return (
101+
<div className="bg-bg-primary min-h-dvh">
102+
<Header title="동의서 작성" showBack />
103+
<main className="mx-auto min-h-[calc(100dvh-60px)] w-full max-w-[430px] min-w-[320px]">
104+
<ConsentPageSkeleton />
105+
</main>
106+
</div>
107+
);
108+
}
109+
110+
function ConsentPageContent({ params }: ConsentPageProps) {
100111
const { exhibitionId } = use(params);
101112
const searchParams = useSearchParams();
102113
const router = useRouter();
@@ -308,3 +319,11 @@ export default function ConsentPage({ params }: ConsentPageProps) {
308319
</div>
309320
);
310321
}
322+
323+
export default function ConsentPage({ params }: ConsentPageProps) {
324+
return (
325+
<Suspense fallback={<ConsentPageFallback />}>
326+
<ConsentPageContent params={params} />
327+
</Suspense>
328+
);
329+
}

src/app/exhibitions/status/page.tsx

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"use client";
22

3+
import { Suspense } from "react";
4+
35
import { useSearchParams } from "next/navigation";
46

57
import Header from "@/components/common/Header";
@@ -26,7 +28,7 @@ function getErrorMessage(error: unknown) {
2628
return error instanceof Error ? error.message : "전시 현황을 불러오지 못했습니다.";
2729
}
2830

29-
export default function ExhibitionStatusPage() {
31+
function ExhibitionStatusContent() {
3032
const searchParams = useSearchParams();
3133
const { isAuthReady, isAuthenticated } = useRequireAuth();
3234

@@ -36,18 +38,39 @@ export default function ExhibitionStatusPage() {
3638
const isLoading = !isAuthReady || (isAuthenticated && query.isLoading);
3739
const errorMessage = query.error ? getErrorMessage(query.error) : null;
3840

41+
return (
42+
<main className="mx-auto min-h-[calc(100dvh-60px)] w-full max-w-97.5 min-w-[320px]">
43+
<StatusFilterTabs activeFilter={activeFilter} />
44+
<ExhibitionStatusList
45+
exhibitions={exhibitions}
46+
isLoading={isLoading}
47+
errorMessage={isAuthenticated ? errorMessage : null}
48+
onRetry={() => void query.refetch()}
49+
/>
50+
</main>
51+
);
52+
}
53+
54+
function ExhibitionStatusFallback() {
55+
return (
56+
<main className="mx-auto min-h-[calc(100dvh-60px)] w-full max-w-97.5 min-w-[320px]">
57+
<ExhibitionStatusList
58+
exhibitions={[]}
59+
isLoading
60+
errorMessage={null}
61+
onRetry={() => undefined}
62+
/>
63+
</main>
64+
);
65+
}
66+
67+
export default function ExhibitionStatusPage() {
3968
return (
4069
<div className="bg-bg-primary min-h-dvh">
4170
<Header title="전시 현황" showBorder={false} />
42-
<main className="mx-auto min-h-[calc(100dvh-60px)] w-full max-w-97.5 min-w-[320px]">
43-
<StatusFilterTabs activeFilter={activeFilter} />
44-
<ExhibitionStatusList
45-
exhibitions={exhibitions}
46-
isLoading={isLoading}
47-
errorMessage={isAuthenticated ? errorMessage : null}
48-
onRetry={() => void query.refetch()}
49-
/>
50-
</main>
71+
<Suspense fallback={<ExhibitionStatusFallback />}>
72+
<ExhibitionStatusContent />
73+
</Suspense>
5174
</div>
5275
);
5376
}

0 commit comments

Comments
 (0)