Skip to content

Commit fc25488

Browse files
Fix Next.js 15 async params compatibility for dynamic project routes
Co-authored-by: rezwana-karim <126201034+rezwana-karim@users.noreply.github.com>
1 parent 612b249 commit fc25488

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@
3737
"eslint": "^9",
3838
"eslint-config-next": "15.5.4",
3939
"tailwindcss": "^4",
40-
"typescript": "^5"
40+
"typescript": "5.9.2"
4141
}
4242
}

src/app/projects/[slug]/page.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import { notFound } from "next/navigation"
1010
import ReactMarkdown from "react-markdown"
1111

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

1818
export async function generateStaticParams() {
@@ -23,7 +23,8 @@ export async function generateStaticParams() {
2323
}
2424

2525
export async function generateMetadata({ params }: ProjectPageProps) {
26-
const project = getProjectBySlug(params.slug)
26+
const { slug } = await params
27+
const project = getProjectBySlug(slug)
2728

2829
if (!project) {
2930
return {
@@ -42,8 +43,9 @@ export async function generateMetadata({ params }: ProjectPageProps) {
4243
}
4344
}
4445

45-
export default function ProjectPage({ params }: ProjectPageProps) {
46-
const project = getProjectBySlug(params.slug)
46+
export default async function ProjectPage({ params }: ProjectPageProps) {
47+
const { slug } = await params
48+
const project = getProjectBySlug(slug)
4749

4850
if (!project) {
4951
notFound()

0 commit comments

Comments
 (0)