Merge pull request #1075 from SohamBhattacharjee2003/fix/deduplicate-getpage-cache

fix: deduplicate getpage cache
This commit is contained in:
Rohan Verma 2026-04-01 13:03:16 -07:00 committed by GitHub
commit 71a5b40513
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,10 +2,15 @@ import { DocsBody, DocsDescription, DocsPage, DocsTitle } from "fumadocs-ui/page
import { notFound } from "next/navigation";
import { source } from "@/lib/source";
import { getMDXComponents } from "@/mdx-components";
import { cache } from "react";
const getDocPage = cache((slug?: string[]) => {
return source.getPage(slug);
});
export default async function Page(props: { params: Promise<{ slug?: string[] }> }) {
const params = await props.params;
const page = source.getPage(params.slug);
const page = getDocPage(params.slug);
if (!page) notFound();
const MDX = page.data.body;
@ -37,7 +42,7 @@ export async function generateStaticParams() {
export async function generateMetadata(props: { params: Promise<{ slug?: string[] }> }) {
const params = await props.params;
const page = source.getPage(params.slug);
const page = getDocPage(params.slug);
if (!page) notFound();
return {