Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Fix page tree slicing when findIndex returns -1

Sushmithamallesh45c4d84582f9
diff --git a/composio-worktree-1 b/composio-worktree-1
new file mode 160000
index 000000000..60d6ccac7
--- /dev/null
+++ b/composio-worktree-1
@@ -0,0 +1 @@
+Subproject commit 60d6ccac747a42b988d21ac524554f04dfdb4d1f
diff --git a/docs/app/(home)/docs/layout.tsx b/docs/app/(home)/docs/layout.tsx
index 649cf8477..13b488700 100644
--- a/docs/app/(home)/docs/layout.tsx
+++ b/docs/app/(home)/docs/layout.tsx
@@ -6,15 +6,18 @@ const children = source.pageTree.children;
const getStartedIdx = children.findIndex(
(c) => c.type === 'separator' && c.name === 'Get Started'
);
-const nextSeparatorIdx = children.findIndex(
- (c, i) => i > getStartedIdx && c.type === 'separator'
-);
+// Find next separator after Get Started, or use end of array if not found
+const nextSeparatorIdx = getStartedIdx === -1
+ ? -1
+ : children.findIndex((c, i) => i > getStartedIdx && c.type === 'separator');
+// If we can't find proper insertion point, append at the end
+const insertIdx = nextSeparatorIdx === -1 ? children.length : nextSeparatorIdx;
const pageTree = {
...source.pageTree,
children: [
- ...children.slice(0, nextSeparatorIdx),
+ ...children.slice(0, insertIdx),
changelogPage,
- ...children.slice(nextSeparatorIdx),
+ ...children.slice(insertIdx),
] as typeof children,
};