Core: Fix failed to update page tree from loader()

This commit is contained in:
Fuma Nama
2025-08-22 19:35:59 +08:00
parent bf049131ef
commit 039b24b402
4 changed files with 24 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-core': patch
---
Fix failed to update page tree from `loader()`
+17 -2
View File
@@ -5,7 +5,7 @@ import type { MDXComponents } from 'mdx/types';
import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
import * as icons from 'lucide-react';
export function getMDXComponents(components?: MDXComponents): MDXComponents {
export function getMDXComponents(components?: MDXComponents) {
return {
...(icons as unknown as MDXComponents),
...defaultMdxComponents,
@@ -14,5 +14,20 @@ export function getMDXComponents(components?: MDXComponents): MDXComponents {
Accordion,
Accordions,
...components,
};
} satisfies MDXComponents;
}
declare module 'mdx/types.js' {
// Augment the MDX types to make it understand React.
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace JSX {
type Element = React.JSX.Element;
type ElementClass = React.JSX.ElementClass;
type ElementType = React.JSX.ElementType;
type IntrinsicElements = React.JSX.IntrinsicElements;
}
}
declare global {
type MDXProvidedComponents = ReturnType<typeof getMDXComponents>;
}
+1
View File
@@ -8,6 +8,7 @@
"include": [
"next-env.d.ts",
"**/*.ts",
"content/**/*.mdx",
"**/*.mts",
"**/*.tsx",
".next/types/**/*.ts",
+1 -1
View File
@@ -367,7 +367,7 @@ function createOutput(options: LoaderOptions): LoaderOutput<LoaderConfig> {
pageTree = v as unknown as Record<string, PageTree.Root>;
} else {
pageTree = {
defaultLanguage: v,
[defaultLanguage]: v,
};
}
},