Skip to content

Comments

Docs breadcrumbs undefined#1303

Open
cellomatt wants to merge 5 commits intomainfrom
cursor/KNO-11552-docs-breadcrumbs-undefined-a7a6
Open

Docs breadcrumbs undefined#1303
cellomatt wants to merge 5 commits intomainfrom
cursor/KNO-11552-docs-breadcrumbs-undefined-a7a6

Conversation

@cellomatt
Copy link
Contributor

@cellomatt cellomatt commented Feb 4, 2026

Description

** Fixed broken breadcrumbs displaying "undefined" on certain nested documentation pages. **

The issue stemmed from lib/content.ts, where the getInAppSidebar function was always constructing four breadcrumb items. When depthFirstSidebarInfo failed to find a matching section or page, undefined values were implicitly converted to the string "undefined" within template literals, leading to incorrect breadcrumb paths.

The fix involves:

  • lib/content.ts: Modifying getInAppSidebar to conditionally add section and page breadcrumbs only when valid slug and title properties exist.
  • components/ui/Breadcrumbs.tsx: Adding a defensive filter to remove any breadcrumb items that have invalid titles or slugs (including the string "undefined") before rendering, providing an additional layer of robustness.

Todos

  • None

Tasks

KNO-11552

Screenshots


Linear Issue: KNO-11552

Open in Cursor Open in Web

Cursor Bugbot found 1 potential issue for commit 6081a8c

- Update getInAppSidebar to only add section/page breadcrumbs when they exist
- Add defensive filtering in Breadcrumbs component to filter out invalid items
- Prevents template literals from converting undefined to the string 'undefined'

Fixes pages like:
- /in-app-ui/android/sdk/overview
- /in-app-ui/android/sdk/quick-start
- /in-app-ui/android/components

Co-authored-by: Matt Kufchak <matt.kufchak@gmail.com>
@cursor
Copy link

cursor bot commented Feb 4, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@linear
Copy link

linear bot commented Feb 4, 2026

@vercel
Copy link

vercel bot commented Feb 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Feb 4, 2026 10:33pm

Request Review

Root cause: Race condition between router query and selectedSdk state
- useState initializer only runs once, potentially with empty paths
- When router becomes ready, selectedSdk wasn't updated
- This caused mismatched sidebar content to be searched

Fix:
- Add useEffect in InAppUILayout to sync selectedSdk with URL path
- Ensures breadcrumbs are computed with correct SDK sidebar content

Expected breadcrumbs now show correctly:
- /in-app-ui/android/sdk/overview: In-App UI > Kotlin (Android) > SDK > Overview
- /in-app-ui/android/components: In-App UI > Kotlin (Android) > UI components > Components

Co-authored-by: Matt Kufchak <matt.kufchak@gmail.com>
Changes:
- Use SDK from URL path directly for breadcrumb computation (avoids timing issues)
- Remove final page from breadcrumbs (only show hierarchy up to section)

Breadcrumbs now show correctly:
- /in-app-ui/android/sdk/overview: In-App UI > Kotlin (Android) > SDK
- /in-app-ui/android/components: In-App UI > Kotlin (Android) > UI components

Co-authored-by: Matt Kufchak <matt.kufchak@gmail.com>
Co-authored-by: Matt Kufchak <matt.kufchak@gmail.com>
Reverted to simpler solution that reliably shows:
- In-App UI > Kotlin (Android)
- In-App UI > React
- etc.

The complex section-finding logic had timing issues with React state
that made it unreliable. This simpler approach prevents 'undefined'
from appearing and shows a clean, consistent breadcrumb trail.

Co-authored-by: Matt Kufchak <matt.kufchak@gmail.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

path: `${section?.slug}${page?.slug}`,
},
],
breadcrumbs,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Section and page breadcrumbs removed instead of conditionally added

Medium Severity

The getInAppSidebar function was intended to conditionally add section and page breadcrumbs when valid slug and title properties exist (as stated in the PR description), but the implementation completely removes them instead. The call to depthFirstSidebarInfo that retrieves the matching section and page was deleted, and the returned breadcrumbs now only contain two levels ("In-App UI" and SDK name) regardless of how deeply nested the current page is. This causes incomplete breadcrumb navigation for all nested documentation pages.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants