@@ -2,23 +2,19 @@ import fs from "fs/promises";
2
2
import path from "path" ;
3
3
4
4
import matter from "gray-matter" ;
5
- import type { MDXComponents } from "mdx/types" ;
6
5
import type { Metadata } from "next" ;
7
6
import Link from "next/link" ;
8
7
import { notFound } from "next/navigation" ;
9
8
import { MDXRemote } from "next-mdx-remote/rsc" ;
10
9
import { Suspense , cache } from "react" ;
11
10
11
+ import { components , mdxOptions } from "@/components/mdx/mdx-components" ;
12
12
import { DocsHeader } from "@/components/page/docs/content/DocsHeader" ;
13
13
import { EditOnGitHub } from "@/components/page/docs/content/EditOnGitHub" ;
14
14
import { ErrorBoundary } from "@/components/page/docs/content/ErrorBoundary" ;
15
15
import { ReadingTime } from "@/components/page/docs/content/ReadingTime" ;
16
16
import { ShortLink } from "@/components/page/docs/content/ShortLink" ;
17
17
import { 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 ;
22
18
23
19
interface DocMeta {
24
20
title : string ;
@@ -95,9 +91,9 @@ interface Props {
95
91
} > ;
96
92
}
97
93
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 ) ;
101
97
if ( ! doc ) {
102
98
return {
103
99
title : "Documentation Not Found" ,
@@ -142,14 +138,12 @@ export async function generateStaticParams() {
142
138
} ) ) ;
143
139
}
144
140
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 ( ) ;
151
145
152
- const currentPath = "/docs/" + params . slug . join ( "/" ) ;
146
+ const currentPath = "/docs/" + resolvedParams . slug . join ( "/" ) ;
153
147
const { prev, next } = getDocNavigation ( currentPath ) ;
154
148
155
149
const category = docsStructure . find ( ( item ) => currentPath . startsWith ( item . path ) ) ?. title ;
@@ -165,7 +159,7 @@ export default async function DocPage(props: Props) {
165
159
< >
166
160
< ReadingTime content = { doc . content } />
167
161
< ShortLink path = { currentPath } />
168
- < EditOnGitHub filePath = { params . slug . join ( "/" ) } />
162
+ < EditOnGitHub filePath = { resolvedParams . slug . join ( "/" ) } />
169
163
</ >
170
164
}
171
165
/>
@@ -176,7 +170,7 @@ export default async function DocPage(props: Props) {
176
170
< Suspense fallback = { < LoadingFallback /> } >
177
171
< MDXRemote
178
172
source = { doc . content }
179
- components = { components as MDXComponents }
173
+ components = { components }
180
174
options = { { mdxOptions } }
181
175
/>
182
176
</ Suspense >
0 commit comments