Skip to content

Commit 0d703b8

Browse files
committed
feat(web): migrate to Next.js 15 with async params
- Upgrade Next.js from 14.2.25 to 15.5.9 - Update all route handlers to use Promise<params> and await params - Update page components to await params/searchParams - Convert client components to use useParams() hook - Fix cookies() to be async (Next.js 15 breaking change) - Add @types/react overrides to fix React 18 type compatibility - Downgrade @types/react from 19.x to 18.x to match React 18.3.1 BREAKING CHANGE: Route params are now async in Next.js 15
1 parent 07dff05 commit 0d703b8

File tree

49 files changed

+209
-193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+209
-193
lines changed

bun.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@
9696
"use-debounce": "^10.0.4",
9797
"zod": "^4.0.0"
9898
},
99+
"overrides": {
100+
"@types/react": "$@types/react",
101+
"@types/react-dom": "$@types/react-dom"
102+
},
99103
"devDependencies": {
100104
"@commitlint/cli": "^19.8.0",
101105
"@commitlint/config-conventional": "^19.8.0",
@@ -108,8 +112,8 @@
108112
"@types/jest": "^29.5.14",
109113
"@types/node": "^22.14.0",
110114
"@types/pg": "^8.11.11",
111-
"@types/react": "^18",
112-
"@types/react-dom": "^18",
115+
"@types/react": "18",
116+
"@types/react-dom": "18",
113117
"@typescript-eslint/eslint-plugin": "^8.29.1",
114118
"@typescript-eslint/parser": "^8.29.1",
115119
"autoprefixer": "^10.4.21",

web/src/app/[sponsee]/page.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,21 @@ import CardWithBeams from '@/components/card-with-beams'
1414
export const generateMetadata = async ({
1515
params,
1616
}: {
17-
params: { sponsee: string }
17+
params: Promise<{ sponsee: string }>
1818
}): Promise<Metadata> => {
19+
const { sponsee } = await params
1920
return {
20-
title: `${params.sponsee}'s Referral | Codebuff`,
21+
title: `${sponsee}'s Referral | Codebuff`,
2122
}
2223
}
2324

2425
export default async function SponseePage({
2526
params,
2627
}: {
27-
params: { sponsee: string }
28+
params: Promise<{ sponsee: string }>
2829
}) {
29-
const sponseeName = params.sponsee.toLowerCase()
30+
const { sponsee } = await params
31+
const sponseeName = sponsee.toLowerCase()
3032

3133
const referralCode = await db
3234
.select({
@@ -41,7 +43,7 @@ export default async function SponseePage({
4143
return (
4244
<CardWithBeams
4345
title="Hmm, that link doesn't look right."
44-
description={`We don't have a referral code for "${params.sponsee}".`}
46+
description={`We don't have a referral code for "${sponsee}".`}
4547
content={
4648
<>
4749
<p className="text-center">

web/src/app/api/admin/orgs/[orgId]/features/[feature]/route.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import type { NextRequest } from 'next/server'
88
import { checkAdminAuth } from '@/app/api/admin/admin-auth'
99

1010
interface RouteParams {
11-
params: {
11+
params: Promise<{
1212
orgId: string
1313
feature: string
14-
}
14+
}>
1515
}
1616

1717
// GET handler to fetch feature configuration
@@ -24,7 +24,7 @@ export async function GET(
2424
return authResult
2525
}
2626

27-
const { orgId, feature } = params
27+
const { orgId, feature } = await params
2828

2929
try {
3030
const featureConfig = await db
@@ -62,7 +62,7 @@ export async function POST(
6262
return authResult
6363
}
6464

65-
const { orgId, feature } = params
65+
const { orgId, feature } = await params
6666
const body = await request.json()
6767

6868
try {

web/src/app/api/admin/traces/[clientRequestId]/messages/route.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import { checkAdminAuth } from '@/lib/admin-auth'
99
import { logger } from '@/util/logger'
1010

1111
interface RouteParams {
12-
params: {
12+
params: Promise<{
1313
clientRequestId: string
14-
}
14+
}>
1515
}
1616

1717
export interface TraceMessage {
@@ -37,7 +37,7 @@ export async function GET(req: NextRequest, { params }: RouteParams) {
3737
return authResult
3838
}
3939

40-
const { clientRequestId } = params
40+
const { clientRequestId } = await params
4141

4242
if (!clientRequestId) {
4343
return NextResponse.json(

web/src/app/api/admin/traces/[clientRequestId]/timeline/route.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import { checkAdminAuth } from '@/lib/admin-auth'
1010
import { logger } from '@/util/logger'
1111

1212
interface RouteParams {
13-
params: {
13+
params: Promise<{
1414
clientRequestId: string
15-
}
15+
}>
1616
}
1717

1818
export interface TimelineEvent {
@@ -40,7 +40,7 @@ export async function GET(req: NextRequest, { params }: RouteParams) {
4040
return authResult
4141
}
4242

43-
const { clientRequestId } = params
43+
const { clientRequestId } = await params
4444

4545
if (!clientRequestId) {
4646
return NextResponse.json(

web/src/app/api/admin/traces/client/[clientId]/sessions/route.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import { checkAdminAuth } from '@/lib/admin-auth'
1313
import { logger } from '@/util/logger'
1414

1515
interface RouteParams {
16-
params: {
16+
params: Promise<{
1717
clientId: string
18-
}
18+
}>
1919
}
2020

2121
export interface ClientMessage {
@@ -45,7 +45,7 @@ export async function GET(req: NextRequest, { params }: RouteParams) {
4545
return authResult
4646
}
4747

48-
const { clientId } = params
48+
const { clientId } = await params
4949

5050
if (!clientId) {
5151
return NextResponse.json(

web/src/app/api/agents/[publisherId]/[agentId]/[version]/route.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ import type { NextRequest } from 'next/server'
88
import { logger } from '@/util/logger'
99

1010
interface RouteParams {
11-
params: {
11+
params: Promise<{
1212
publisherId: string
1313
agentId: string
1414
version: string
15-
}
15+
}>
1616
}
1717

1818
export async function GET(request: NextRequest, { params }: RouteParams) {
1919
try {
20-
const { publisherId, agentId, version } = params
20+
const { publisherId, agentId, version } = await params
2121

2222
if (!publisherId || !agentId || !version) {
2323
return NextResponse.json(

web/src/app/api/agents/[publisherId]/[agentId]/latest/route.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ import type { NextRequest } from 'next/server'
88
import { logger } from '@/util/logger'
99

1010
interface RouteParams {
11-
params: {
11+
params: Promise<{
1212
publisherId: string
1313
agentId: string
14-
}
14+
}>
1515
}
1616

1717
export async function GET(request: NextRequest, { params }: RouteParams) {
1818
try {
19-
const { publisherId, agentId } = params
19+
const { publisherId, agentId } = await params
2020

2121
if (!publisherId || !agentId) {
2222
return NextResponse.json(

web/src/app/api/invites/[token]/route.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ import { authOptions } from '@/app/api/auth/[...nextauth]/auth-options'
1111
import { logger } from '@/util/logger'
1212

1313
interface RouteParams {
14-
params: { token: string }
14+
params: Promise<{ token: string }>
1515
}
1616

1717
export async function GET(request: NextRequest, { params }: RouteParams) {
1818
try {
19-
const { token } = params
19+
const { token } = await params
2020

2121
// Get invitation details
2222
const invitation = await db
@@ -73,7 +73,7 @@ export async function GET(request: NextRequest, { params }: RouteParams) {
7373
},
7474
})
7575
} catch (error) {
76-
logger.error({ token: params.token, error }, 'Error fetching invitation')
76+
logger.error({ error }, 'Error fetching invitation')
7777
return NextResponse.json(
7878
{ error: 'Internal server error' },
7979
{ status: 500 },
@@ -88,7 +88,7 @@ export async function POST(request: NextRequest, { params }: RouteParams) {
8888
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
8989
}
9090

91-
const { token } = params
91+
const { token } = await params
9292

9393
// Get invitation details
9494
const invitation = await db
@@ -209,7 +209,7 @@ export async function POST(request: NextRequest, { params }: RouteParams) {
209209
},
210210
})
211211
} catch (error) {
212-
logger.error({ token: params.token, error }, 'Error accepting invitation')
212+
logger.error({ error }, 'Error accepting invitation')
213213
return NextResponse.json(
214214
{ error: 'Internal server error' },
215215
{ status: 500 },

0 commit comments

Comments
 (0)