Conversation
- 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 Agent can help with this pull request. Just |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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>
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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.


Description
** Fixed broken breadcrumbs displaying "undefined" on certain nested documentation pages. **
The issue stemmed from
lib/content.ts, where thegetInAppSidebarfunction was always constructing four breadcrumb items. WhendepthFirstSidebarInfofailed to find a matching section or page,undefinedvalues were implicitly converted to the string "undefined" within template literals, leading to incorrect breadcrumb paths.The fix involves:
lib/content.ts: ModifyinggetInAppSidebarto conditionally add section and page breadcrumbs only when validslugandtitleproperties 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
Tasks
KNO-11552
Screenshots
Linear Issue: KNO-11552


Cursor Bugbot found 1 potential issue for commit 6081a8c