@@ -2,23 +2,19 @@ import fs from "fs/promises";
22import path from "path" ;
33
44import matter from "gray-matter" ;
5- import type { MDXComponents } from "mdx/types" ;
65import type { Metadata } from "next" ;
76import Link from "next/link" ;
87import { notFound } from "next/navigation" ;
98import { MDXRemote } from "next-mdx-remote/rsc" ;
109import { Suspense , cache } from "react" ;
1110
11+ import { components , mdxOptions } from "@/components/mdx/mdx-components" ;
1212import { DocsHeader } from "@/components/page/docs/content/DocsHeader" ;
1313import { EditOnGitHub } from "@/components/page/docs/content/EditOnGitHub" ;
1414import { ErrorBoundary } from "@/components/page/docs/content/ErrorBoundary" ;
1515import { ReadingTime } from "@/components/page/docs/content/ReadingTime" ;
1616import { ShortLink } from "@/components/page/docs/content/ShortLink" ;
1717import { docsStructure } from "@/components/page/docs/sidebar-structure" ;
18- import { components , mdxOptions } from "@/lib/mdx" ;
19-
20- export const dynamic = "force-static" ;
21- export const revalidate = 5 ;
2218
2319interface DocMeta {
2420 title : string ;
@@ -95,9 +91,9 @@ interface Props {
9591 } > ;
9692}
9793
98- export async function generateMetadata ( props : Props ) : Promise < Metadata > {
99- const params = await props . params ;
100- const doc = await getDocBySlug ( params . slug ) ;
94+ export async function generateMetadata ( { params } : Props ) : Promise < Metadata > {
95+ const resolvedParams = await params ;
96+ const doc = await getDocBySlug ( resolvedParams . slug ) ;
10197 if ( ! doc ) {
10298 return {
10399 title : "Documentation Not Found" ,
@@ -142,14 +138,12 @@ export async function generateStaticParams() {
142138 } ) ) ;
143139}
144140
145- export default async function DocPage ( props : Props ) {
146- const params = await props . params ;
147- const doc = await getDocBySlug ( params . slug ) ;
148- if ( ! doc ) {
149- notFound ( ) ;
150- }
141+ export default async function DocPage ( { params } : Props ) {
142+ const resolvedParams = await params ;
143+ const doc = await getDocBySlug ( resolvedParams . slug ) ;
144+ if ( ! doc ) notFound ( ) ;
151145
152- const currentPath = "/docs/" + params . slug . join ( "/" ) ;
146+ const currentPath = "/docs/" + resolvedParams . slug . join ( "/" ) ;
153147 const { prev, next } = getDocNavigation ( currentPath ) ;
154148
155149 const category = docsStructure . find ( ( item ) => currentPath . startsWith ( item . path ) ) ?. title ;
@@ -165,7 +159,7 @@ export default async function DocPage(props: Props) {
165159 < >
166160 < ReadingTime content = { doc . content } />
167161 < ShortLink path = { currentPath } />
168- < EditOnGitHub filePath = { params . slug . join ( "/" ) } />
162+ < EditOnGitHub filePath = { resolvedParams . slug . join ( "/" ) } />
169163 </ >
170164 }
171165 />
@@ -176,7 +170,7 @@ export default async function DocPage(props: Props) {
176170 < Suspense fallback = { < LoadingFallback /> } >
177171 < MDXRemote
178172 source = { doc . content }
179- components = { components as MDXComponents }
173+ components = { components }
180174 options = { { mdxOptions } }
181175 />
182176 </ Suspense >
0 commit comments