From e38cb760b61f542ae3a81700fb45dce787126bc8 Mon Sep 17 00:00:00 2001 From: juliusmarminge Date: Sat, 4 Jan 2025 01:44:00 +0100 Subject: [PATCH] fix dynamic params --- docs/src/app/blog/category/[category]/page.tsx | 7 ++++--- .../with-drizzle-appdir/src/app/api/file/[key]/route.ts | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/src/app/blog/category/[category]/page.tsx b/docs/src/app/blog/category/[category]/page.tsx index c2f7bb5c61..697db1b0ee 100644 --- a/docs/src/app/blog/category/[category]/page.tsx +++ b/docs/src/app/blog/category/[category]/page.tsx @@ -13,10 +13,11 @@ export async function generateStaticParams() { return allTags.map((tag) => ({ category: tag })); } -export default function ArticlesIndex( +export default async function ArticlesIndex( props: Readonly<{ - params: { category: string }; + params: Promise<{ category: string }>; }>, ) { - return ; + const { category } = await props.params; + return ; } diff --git a/examples/with-drizzle-appdir/src/app/api/file/[key]/route.ts b/examples/with-drizzle-appdir/src/app/api/file/[key]/route.ts index 3933b2185a..ef0df4e751 100644 --- a/examples/with-drizzle-appdir/src/app/api/file/[key]/route.ts +++ b/examples/with-drizzle-appdir/src/app/api/file/[key]/route.ts @@ -13,9 +13,9 @@ export const revalidate = false; export async function GET( _req: NextRequest, - props: { params: { key: string } }, + props: { params: Promise<{ key: string }> }, ) { - const key = props.params.key; + const { key } = await props.params; if (!key) { return NextResponse.json({ error: "No key" }, { status: 400 }); }