Skip to content

Commit 3689e39

Browse files
committed
feat: refactor to use connection from next/server in multiple pages
1 parent 08761c1 commit 3689e39

6 files changed

Lines changed: 18 additions & 12 deletions

File tree

src/app/(cfp)/cfp/expense/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
export const dynamic = 'force-dynamic'
2-
1+
import { connection } from 'next/server'
32
import { getAuthSession } from '@/lib/auth'
43
import { redirect } from 'next/navigation'
54
import { headers } from 'next/headers'
@@ -41,6 +40,8 @@ function NotEligibleDisplay() {
4140
}
4241

4342
export default async function TravelExpensePage() {
43+
await connection()
44+
4445
const headersList = await headers()
4546
const fullUrl = headersList.get('x-url') || ''
4647
const session = await getAuthSession({ url: fullUrl })

src/app/(cfp)/cfp/list/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
export const dynamic = 'force-dynamic'
2-
1+
import { connection } from 'next/server'
32
import { getAuthSession } from '@/lib/auth'
43
import { redirect } from 'next/navigation'
54
import { headers } from 'next/headers'
@@ -21,6 +20,8 @@ import type { ConferenceWithSpeakerData } from '@/lib/dashboard/types'
2120
import type { BadgeRecord } from '@/lib/badge/types'
2221

2322
export default async function SpeakerDashboard() {
23+
await connection()
24+
2425
const headersList = await headers()
2526
const fullUrl = headersList.get('x-url') || ''
2627
const { domain } = await getConferenceForCurrentDomain({})

src/app/(cfp)/cfp/profile/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
export const dynamic = 'force-dynamic'
2-
1+
import { connection } from 'next/server'
32
import { getAuthSession } from '@/lib/auth'
43
import { getSpeaker } from '@/lib/speaker/sanity'
54
import { redirect } from 'next/navigation'
@@ -8,6 +7,8 @@ import { CFPProfilePage } from '@/components/cfp/CFPProfilePage'
87
import { getConferenceForCurrentDomain } from '@/lib/conference/sanity'
98

109
export default async function ProfilePage() {
10+
await connection()
11+
1112
const headersList = await headers()
1213
const fullUrl = headersList.get('x-url') || ''
1314
const session = await getAuthSession({ url: fullUrl })

src/app/(cfp)/cfp/proposal/[[...id]]/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
export const dynamic = 'force-dynamic'
2-
1+
import { connection } from 'next/server'
32
import { XCircleIcon } from '@heroicons/react/24/solid'
43
import Link from 'next/link'
54
import {
@@ -29,6 +28,8 @@ export default async function ProposalPage({
2928
params: Promise<{ id?: string[] }>
3029
searchParams: Promise<{ id?: string }>
3130
}) {
31+
await connection()
32+
3233
// Support both /cfp/proposal/[id] and /cfp/proposal?id=[id] patterns
3334
const routeParams = await params
3435
const queryParams = await searchParams

src/app/(cfp)/cfp/proposal/[id]/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
export const dynamic = 'force-dynamic'
2-
1+
import { connection } from 'next/server'
32
import { notFound, redirect } from 'next/navigation'
43
import { headers } from 'next/headers'
54
import { getProposalSanity as getProposal } from '@/lib/proposal/server'
@@ -23,6 +22,8 @@ interface ProposalViewPageProps {
2322
export default async function ProposalViewPage({
2423
params,
2524
}: ProposalViewPageProps) {
25+
await connection()
26+
2627
const { id } = await params
2728
const headersList = await headers()
2829
const fullUrl = headersList.get('x-url') || ''

src/app/(cfp)/cfp/workshop/[id]/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
export const dynamic = 'force-dynamic'
2-
1+
import { connection } from 'next/server'
32
import { redirect } from 'next/navigation'
43
import { headers } from 'next/headers'
54
import { getAuthSession } from '@/lib/auth'
@@ -45,6 +44,8 @@ interface WorkshopDetails {
4544
export default async function WorkshopDetailsPage({
4645
params,
4746
}: WorkshopDetailsPageProps) {
47+
await connection()
48+
4849
const { id: workshopId } = await params
4950
const headersList = await headers()
5051
const fullUrl = headersList.get('x-url') || ''

0 commit comments

Comments
 (0)