diff --git a/src/app/[[...slug]]/page.tsx b/src/app/[[...slug]]/page.tsx index f875de4..8ff0a16 100644 --- a/src/app/[[...slug]]/page.tsx +++ b/src/app/[[...slug]]/page.tsx @@ -38,17 +38,11 @@ export default async function Page(props: PageProps<"/[[...slug]]">) { ); } -export async function generateStaticParams() { - const params = source.generateParams(); - - // Ensure we include the root path for optional catch-all routes - const hasRootPath = params.some((p) => !p.slug || p.slug.length === 0); - - if (!hasRootPath) { - return [{ slug: undefined }, ...params]; - } - - return params; +export function generateStaticParams() { + return [ + { slug: [] }, // Handle root path + ...source.generateParams() + ] } export async function generateMetadata( diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 4eb5245..bbdf2ac 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -5,6 +5,7 @@ import { Inter } from "next/font/google"; import { cn } from "@/lib/cn"; import { source } from "@/lib/source"; import { DocsLayout } from "@/components/layout/docs"; +import { DefaultSearchDialog } from "@/components/search"; const inter = Inter({ subsets: ["latin"], @@ -75,7 +76,7 @@ export default function Layout({ children }: LayoutProps<"/">) { /> - + {children} diff --git a/src/components/layout/sidebar/base.tsx b/src/components/layout/sidebar/base.tsx index 8cd7b8a..f4d9c24 100644 --- a/src/components/layout/sidebar/base.tsx +++ b/src/components/layout/sidebar/base.tsx @@ -269,14 +269,13 @@ export function SidebarItem({ }) { const pathname = usePathname(); const ref = useRef(null); - const { prefetch } = useSidebar(); const active = - props.href !== undefined && isActive(props.href, pathname, false); - + props.href !== undefined && isActive(props.href, pathname, false); + useAutoScroll(active, ref); return ( - + {icon ?? (props.external ? : null)} {children} diff --git a/src/components/search.tsx b/src/components/search.tsx index 09f7197..9b712b9 100644 --- a/src/components/search.tsx +++ b/src/components/search.tsx @@ -23,7 +23,7 @@ function initOrama() { }); } -export default function DefaultSearchDialog(props: SharedProps) { +export function DefaultSearchDialog(props: SharedProps) { const { locale } = useI18n(); // (optional) for i18n const { search, setSearch, query } = useDocsSearch({ type: 'static', @@ -40,8 +40,8 @@ export default function DefaultSearchDialog(props: SharedProps) { - + ); -} \ No newline at end of file +}