UI: Improve performance

This commit is contained in:
Fuma Nama
2025-02-23 16:49:41 +08:00
parent d724e18771
commit ecacb53d08
3 changed files with 7 additions and 8 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-ui': patch
---
Improve performance
+1 -1
View File
@@ -102,7 +102,7 @@ import { RootProvider } from 'fumadocs-ui/root-provider';
### Search Options
Pass options to the search client (e.g. the [options](/docs/headless/search/orama#options) for Orama).
Pass options to the search client, like changing the API endpoint for Orama search server:
```tsx
import { RootProvider } from 'fumadocs-ui/root-provider';
+1 -7
View File
@@ -5,7 +5,6 @@ import { usePathname } from 'next/navigation';
import {
type ButtonHTMLAttributes,
createContext,
Fragment,
type HTMLAttributes,
type PointerEventHandler,
type ReactNode,
@@ -414,7 +413,6 @@ export function SidebarPageTree(props: {
components?: Partial<SidebarComponents>;
}) {
const { root } = useTreeContext();
const idRef = useRef(0);
return useMemo(() => {
const { Separator, Item, Folder } = props.components ?? {};
@@ -464,11 +462,7 @@ export function SidebarPageTree(props: {
});
}
return (
<Fragment key={idRef.current++}>
{renderSidebarList(root.children, 1)}
</Fragment>
);
return renderSidebarList(root.children, 1);
}, [props.components, root.children]);
}