Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
docs: stop restructuring the reference layouts
Extracting buildReferenceTree() existed only so a module-level memo could reuse the tree. The memo is gone, so the extraction was scaffolding for nothing and every reference-layout hunk was pure churn in a PR about adding an event. Both files go back to their shape on next, plus the same four lines the docs and examples layouts already take. The non-test diff is now insertions only. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Kshitij Jhunjhunwala committed
Aug 17, 2026 at 13:45 UTC
d9186c1b15dedefab9a8f6f54685ba491bfd74d1
2 files changed
+8
-15
docs/app/(home)/reference/(v31)/layout.tsx
+4
-8
@@ -5,7 +5,7 @@ import { prepareTree } from '@/lib/filter-api-version';
5
import { buildSidebarNavIndex } from '@/lib/sidebar-nav-index';
6
import { SidebarAnalytics } from '@/components/sidebar-analytics';
7
8
-async function buildReferenceTree() {
8
+export default async function Layout({ children }: { children: ReactNode }) {
9
const source = await getReferenceSource();
10
const tree = prepareTree(source.pageTree, '3.1');
11
const changelogPage = { type: 'page' as const, name: 'Changelog', url: '/reference/changelog' };
@@ -14,8 +14,7 @@ async function buildReferenceTree() {
14
child => child.type === 'page' && child.name === 'Overview'
15
);
16
const insertIdx = overviewIdx === -1 ? Math.min(1, tree.children.length) : overviewIdx + 1;
17
-
18
- return {
17
+ const pageTree = {
18
...tree,
19
children: [
20
...tree.children.slice(0, insertIdx),
@@ -23,10 +22,7 @@ async function buildReferenceTree() {
22
...tree.children.slice(insertIdx),
23
] as typeof tree.children,
24
};
26
-}
27
-
28
-export default async function Layout({ children }: { children: ReactNode }) {
29
- const pageTree = await buildReferenceTree();
25
+ const navIndex = buildSidebarNavIndex(pageTree);
26
27
return (
28
<DocsLayout
@@ -36,7 +32,7 @@ export default async function Layout({ children }: { children: ReactNode }) {
32
sidebar={{ collapsible: false, footer: null, tabs: false }}
33
themeSwitch={{ enabled: false }}
34
>
39
- <SidebarAnalytics index={buildSidebarNavIndex(pageTree)} />
35
+ <SidebarAnalytics index={navIndex} />
36
{children}
37
</DocsLayout>
38
);
docs/app/(home)/reference/v3/layout.tsx
+4
-7
@@ -5,13 +5,10 @@ import { prepareTree } from '@/lib/filter-api-version';
5
import { buildSidebarNavIndex } from '@/lib/sidebar-nav-index';
6
import { SidebarAnalytics } from '@/components/sidebar-analytics';
7
8
-async function buildReferenceTree() {
9
- const source = await getReferenceSource();
10
- return prepareTree(source.pageTree, '3.0');
11
-}
12
-
8
export default async function Layout({ children }: { children: ReactNode }) {
14
- const tree = await buildReferenceTree();
9
+ const source = await getReferenceSource();
10
+ const tree = prepareTree(source.pageTree, '3.0');
11
+ const navIndex = buildSidebarNavIndex(tree);
12
13
return (
14
<DocsLayout
@@ -21,7 +18,7 @@ export default async function Layout({ children }: { children: ReactNode }) {
18
sidebar={{ collapsible: false, footer: null, tabs: false }}
19
themeSwitch={{ enabled: false }}
20
>
24
- <SidebarAnalytics index={buildSidebarNavIndex(tree)} />
21
+ <SidebarAnalytics index={navIndex} />
22
{children}
23
</DocsLayout>
24
);