docs: improvement to sidebar (#11810)

* docs: improvement to sidebar

* fix sidebar
This commit is contained in:
Shahed Nasser
2025-03-11 16:48:01 +02:00
committed by GitHub
parent e0277e375e
commit ef66ff8f99
3 changed files with 33 additions and 26 deletions
@@ -301,7 +301,7 @@ export const SidebarProvider = ({
}, [scrollableElement, isBrowser])
const activeMainSidebar = useMemo(() => {
if (!activePath) {
if (!activePath || sidebars.length === 1) {
// set first sidebar as active
return sidebars[0]
}
@@ -357,7 +357,7 @@ export const SidebarProvider = ({
const shownSidebar = useMemo(() => {
if (!sidebarHistory.length) {
return
return sidebars.length === 1 ? sidebars[0] : undefined
}
return getSidebar(sidebarHistory[sidebarHistory.length - 1])