Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

fix(ui): keep table-of-contents keys unique across repeated headings (#1053)

Raghav Chamadiyad59eae822df5
diff --git a/packages/ui/src/wiki/table-of-contents.tsx b/packages/ui/src/wiki/table-of-contents.tsx
index 65fbdcde9..b7e7c7330 100644
--- a/packages/ui/src/wiki/table-of-contents.tsx
+++ b/packages/ui/src/wiki/table-of-contents.tsx
@@ -59,8 +59,11 @@ export function TableOfContents({ content }: { content: string }) {
</p>
{/* Left rail: a hairline the active item's accent bar sits on. */}
<ul className="border-l border-[var(--color-border-default)]">
- {headings.map(({ id, text, level }) => (
- <li key={id}>
+ {/* A page can repeat a heading (two "Examples" sections, or a
+ duplicated section from generation), which slugifies to the same
+ id, so the list index keeps the React key unique. */}
+ {headings.map(({ id, text, level }, index) => (
+ <li key={`${id}-${index}`}>
<a
href={`#${id}`}
className={cn(