Skip to content

Commit

Permalink
fix dynamic params
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusmarminge committed Jan 4, 2025
1 parent a511d0c commit e38cb76
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions docs/src/app/blog/category/[category]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ArticlesPage tag={props.params.category} />;
const { category } = await props.params;
return <ArticlesPage tag={category} />;
}
4 changes: 2 additions & 2 deletions examples/with-drizzle-appdir/src/app/api/file/[key]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}
Expand Down

0 comments on commit e38cb76

Please sign in to comment.