fix(kno-11552): remove undefined breadcrumbs from docs#1344
fix(kno-11552): remove undefined breadcrumbs from docs#1344
undefined breadcrumbs from docs#1344Conversation
- In getInAppSidebar, only add section/page breadcrumbs when they exist to avoid template literals converting undefined to 'undefined' strings - Add useEffect to sync selectedSdk when router paths change after hydration - Derive effectiveSdk directly from URL path for immediate breadcrumb rendering - Pass effectiveSdk to InAppSidebar for consistent dropdown display Fixes pages like /in-app-ui/android/sdk/overview and /in-app-ui/android/components that were showing 'undefined' and 'undefinedundefined' in breadcrumbs. Resolves KNO-11552 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.
|
There was a problem hiding this comment.
Risk HIGH: Fixes "undefined" appearing in breadcrumbs on nested in-app UI pages by adding conditional breadcrumb generation and syncing SDK state with the URL path.
Reasons
layouts/InAppUILayout.tsx(a.tsxfile inlayouts/) is modified — triggers HIGH risk per classification ruleslib/content.ts(a.tsfile inlib/) is modified — triggers HIGH risk per classification rules- Changes affect breadcrumb generation logic used across all in-app UI pages, making this a shared/reusable code path
- A new
useEffecthook is introduced in the layout component, altering React lifecycle behavior - State derivation logic is changed (new
effectiveSdkvariable replaces directselectedSdkusage), which could affect rendering across multiple pages
Notes
- Verify the
useEffectdependency array ([paths, selectedSdk]) does not cause unnecessary re-renders or infinite loops —selectedSdkis set inside the effect and is also a dependency - Confirm breadcrumbs render correctly on all in-app UI nested pages (e.g.,
/in-app-ui/react/overview,/in-app-ui/react/feed/components) after the conditional push logic inlib/content.ts - Check that the
effectiveSdkderivation handles edge cases such as direct navigation, browser back/forward, and initial SSR hydration - The Vercel preview deployment is live — recommend manually testing breadcrumb rendering on several nested paths before merging
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.
| ) { | ||
| setSelectedSdk(sdkFromPath); | ||
| } | ||
| }, [paths, selectedSdk]); |
There was a problem hiding this comment.
useEffect reverts SDK state during SDK switch
Medium Severity
The useEffect includes selectedSdk in its dependency array, causing it to fire when handleSdkChange updates state. Since router.push() is async, the URL path still reflects the old SDK at that point, so sdkFromPath !== selectedSdk evaluates to true and the effect calls setSelectedSdk(sdkFromPath), reverting the user's selection. Combined with effectiveSdk always prioritizing the path-derived SDK, the dropdown visibly snaps back to the previous SDK until the route transition completes, causing unnecessary re-renders and a brief UI flicker.
Additional Locations (1)
|
This is a simple fix that doesn't include nested sections (like SDK and UI Components), but I think that ok and it removes the erroneous |
undefined breadcrumbs from docs




Description
This PR resolves the issue of "undefined" appearing in breadcrumbs on certain nested documentation pages, particularly within the
/in-app-uisection.Why:
The problem stemmed from two main issues:
getInAppSidebarfunction inlib/content.tswas unconditionally generating breadcrumb items, leading toundefinedvalues being converted to the string"undefined"when a matching section or page was not found.layouts/InAppUILayout.tsx, theselectedSdkReact state was not reliably syncing with the Next.js router's path after client-side hydration. This caused the breadcrumb logic to use an outdated SDK context, resulting in failed lookups.How:
lib/content.ts: ThegetInAppSidebarfunction now conditionally adds breadcrumb items only when validslugandtitleproperties exist for the section or page.layouts/InAppUILayout.tsx:useEffecthook was added to synchronize theselectedSdkstate with the SDK value extracted from the URL path, ensuring the correct SDK context is always available.validSdkFromPath) over theselectedSdkstate, mitigating timing issues.InAppSidebarcomponent now uses aneffectiveSdkprop to ensure the dropdown consistently reflects the current page's SDK.Todos
Tasks
Screenshots
Old:

New:

Linear Issue: KNO-11552