11import { SudoGuard } from "@othi/components/SudoGuard" ;
2- import type { Params } from "lib/generics" ;
32import { MoveLeft } from "lucide-react" ;
43import Link from "next/link" ;
54import { trpcServer } from "protocol/trpc/react/server" ;
@@ -8,11 +7,15 @@ import { HtmlContent } from "@othi/components/typography";
87import type { Metadata } from "next" ;
98import { format } from "date-fns" ;
109
11- export async function generateMetadata ( { params } : Params ) : Promise < Metadata > {
10+ export async function generateMetadata ( {
11+ params,
12+ } : {
13+ params : Promise < Record < string , string > > ;
14+ } ) : Promise < Metadata > {
1215 // this always runs until completion so loading files might not show up if
1316 // using the same action
1417 // TODO: cache the meta queries
15- const id = params ? .id as string ;
18+ const id = ( await params ) . id as string ;
1619 const data = await trpcServer . blog . byId ( { id } ) ;
1720 const title = data ?. meta . title ;
1821 const description = "Othi's blog" ;
@@ -35,8 +38,12 @@ export async function generateMetadata({ params }: Params): Promise<Metadata> {
3538 } ;
3639}
3740
38- export default async function Page ( { params } : Params ) {
39- const id = params ?. id as string ;
41+ export default async function Page ( {
42+ params,
43+ } : {
44+ params : Promise < Record < string , string > > ;
45+ } ) {
46+ const id = ( await params ) . id as string ;
4047 const data = await trpcServer . blog . byId ( { id } ) ;
4148
4249 if ( ! data ) return "not found" ;
0 commit comments