Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
docs: build the reference nav index from the tree the layout already awaited
Kshitij Jhunjhunwala68c6c0a889b0
diff --git a/docs/app/(home)/reference/(v31)/layout.tsx b/docs/app/(home)/reference/(v31)/layout.tsxindex 180b08cd8..22f7ef665 100644--- a/docs/app/(home)/reference/(v31)/layout.tsx+++ b/docs/app/(home)/reference/(v31)/layout.tsx@@ -2,7 +2,7 @@ import { getReferenceSource } from '@/lib/source';import { DocsLayout } from 'fumadocs-ui/layouts/docs';import type { ReactNode } from 'react';import { prepareTree } from '@/lib/filter-api-version';-import { buildSidebarNavIndex, type SidebarNavIndex } from '@/lib/sidebar-nav-index';+import { buildSidebarNavIndex } from '@/lib/sidebar-nav-index';import { SidebarAnalytics } from '@/components/sidebar-analytics';async function buildReferenceTree() {@@ -25,15 +25,6 @@ async function buildReferenceTree() {};}-// The tree is only reachable after an await, so the index is memoized here-// rather than hoisted to module scope like the docs and examples sidebars.-let navIndex: SidebarNavIndex | undefined;--async function getNavIndex(): Promise<SidebarNavIndex> {- navIndex ??= buildSidebarNavIndex(await buildReferenceTree());- return navIndex;-}-export default async function Layout({ children }: { children: ReactNode }) {const pageTree = await buildReferenceTree();@@ -45,7 +36,7 @@ export default async function Layout({ children }: { children: ReactNode }) {sidebar={{ collapsible: false, footer: null, tabs: false }}themeSwitch={{ enabled: false }}>- <SidebarAnalytics index={await getNavIndex()} />+ <SidebarAnalytics index={buildSidebarNavIndex(pageTree)} />{children}</DocsLayout>);diff --git a/docs/app/(home)/reference/v3/layout.tsx b/docs/app/(home)/reference/v3/layout.tsxindex c8c1de638..932bdc3e2 100644--- a/docs/app/(home)/reference/v3/layout.tsx+++ b/docs/app/(home)/reference/v3/layout.tsx@@ -2,7 +2,7 @@ import { getReferenceSource } from '@/lib/source';import { DocsLayout } from 'fumadocs-ui/layouts/docs';import type { ReactNode } from 'react';import { prepareTree } from '@/lib/filter-api-version';-import { buildSidebarNavIndex, type SidebarNavIndex } from '@/lib/sidebar-nav-index';+import { buildSidebarNavIndex } from '@/lib/sidebar-nav-index';import { SidebarAnalytics } from '@/components/sidebar-analytics';async function buildReferenceTree() {@@ -10,15 +10,6 @@ async function buildReferenceTree() {return prepareTree(source.pageTree, '3.0');}-// The tree is only reachable after an await, so the index is memoized here-// rather than hoisted to module scope like the docs and examples sidebars.-let navIndex: SidebarNavIndex | undefined;--async function getNavIndex(): Promise<SidebarNavIndex> {- navIndex ??= buildSidebarNavIndex(await buildReferenceTree());- return navIndex;-}-export default async function Layout({ children }: { children: ReactNode }) {const tree = await buildReferenceTree();@@ -30,7 +21,7 @@ export default async function Layout({ children }: { children: ReactNode }) {sidebar={{ collapsible: false, footer: null, tabs: false }}themeSwitch={{ enabled: false }}>- <SidebarAnalytics index={await getNavIndex()} />+ <SidebarAnalytics index={buildSidebarNavIndex(tree)} />{children}</DocsLayout>);