Skip to content

Commit 230359d

Browse files
committed
feat: update params type to Promise for generateMetadata and page components
1 parent c77b760 commit 230359d

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

app/existing/[repoUrl]/page.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ import { absoluteUrl } from "@/lib/site-metadata"
77
import type { RepoScanRouteParams } from "@/types/repo-scan"
88

99
type RepoScanPageProps = {
10-
params: RepoScanRouteParams
10+
params: Promise<RepoScanRouteParams>
1111
}
1212

1313
const toSlug = (repoUrl: string) => repoUrl.replace(/^https:\/\/github.com\//, "")
1414

15-
export function generateMetadata({ params }: RepoScanPageProps): Metadata {
16-
const decoded = decodeRepoRouteParam(params.repoUrl)
15+
export async function generateMetadata({ params }: RepoScanPageProps): Promise<Metadata> {
16+
const resolvedParams = await params
17+
const decoded = decodeRepoRouteParam(resolvedParams.repoUrl)
1718
const normalized = decoded ? normalizeGitHubRepoInput(decoded) ?? decoded : null
1819
const repoSlug = normalized ? toSlug(normalized) : null
1920
const title = repoSlug ? `Repo scan · ${repoSlug}` : "Repo scan"
@@ -47,8 +48,9 @@ export function generateMetadata({ params }: RepoScanPageProps): Metadata {
4748
}
4849
}
4950

50-
export default function RepoScanPage({ params }: RepoScanPageProps) {
51-
const decoded = decodeRepoRouteParam(params.repoUrl)
51+
export default async function RepoScanPage({ params }: RepoScanPageProps) {
52+
const resolvedParams = await params
53+
const decoded = decodeRepoRouteParam(resolvedParams.repoUrl)
5254
const normalized = decoded ? normalizeGitHubRepoInput(decoded) ?? decoded : null
5355

5456
return <RepoScanClient initialRepoUrl={normalized ?? decoded ?? null} />

app/new/stack/[[...stackSegments]]/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type MetadataProps = {
2020
}
2121

2222
type PageProps = {
23-
params: PageParams
23+
params: Promise<PageParams>
2424
}
2525

2626
export async function generateMetadata({ params }: MetadataProps): Promise<Metadata> {
@@ -92,7 +92,8 @@ export async function generateMetadata({ params }: MetadataProps): Promise<Metad
9292
}
9393

9494
export default async function StackRoutePage({ params }: PageProps) {
95-
const { stackSegments } = params
95+
const resolvedParams = await params
96+
const { stackSegments } = resolvedParams
9697
let stackIdFromRoute: string | null = null
9798
let summaryMode: "default" | "user" | null = null
9899

test-results/.last-run.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"status": "passed",
3+
"failedTests": []
4+
}

0 commit comments

Comments
 (0)