Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 22, 14:30 UTC
Fix page tree slicing when findIndex returns -1
Sushmithamallesh committed
Jan 22, 2026 at 11:41 UTC
45c4d84582f9f53d7554703725d446b2837816a1
2 files changed
+9
-5
composio-worktree-1
new
+1
@@ -0,0 +1 @@
1
+Subproject commit 60d6ccac747a42b988d21ac524554f04dfdb4d1f
docs/app/(home)/docs/layout.tsx
+8
-5
@@ -6,15 +6,18 @@ const children = source.pageTree.children;
6
const getStartedIdx = children.findIndex(
7
(c) => c.type === 'separator' && c.name === 'Get Started'
8
);
9
-const nextSeparatorIdx = children.findIndex(
10
- (c, i) => i > getStartedIdx && c.type === 'separator'
11
-);
9
+// Find next separator after Get Started, or use end of array if not found
10
+const nextSeparatorIdx = getStartedIdx === -1
11
+ ? -1
12
+ : children.findIndex((c, i) => i > getStartedIdx && c.type === 'separator');
13
+// If we can't find proper insertion point, append at the end
14
+const insertIdx = nextSeparatorIdx === -1 ? children.length : nextSeparatorIdx;
15
const pageTree = {
16
...source.pageTree,
17
children: [
15
- ...children.slice(0, nextSeparatorIdx),
18
+ ...children.slice(0, insertIdx),
19
changelogPage,
17
- ...children.slice(nextSeparatorIdx),
20
+ ...children.slice(insertIdx),
21
] as typeof children,
22
};
23