diff --git a/CHANGELOG.md b/CHANGELOG.md index c81671e..49cd8cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Selection of active panel when `active` is provided to main navigation items. + ## [3.2.0] - 2024-01-24 ### Added diff --git a/src/lib/Layout/PanelSideBarLayout/PanelSideBar/Context/PanelSideBarContext.tsx b/src/lib/Layout/PanelSideBarLayout/PanelSideBar/Context/PanelSideBarContext.tsx index 9e86550..d107552 100644 --- a/src/lib/Layout/PanelSideBarLayout/PanelSideBar/Context/PanelSideBarContext.tsx +++ b/src/lib/Layout/PanelSideBarLayout/PanelSideBar/Context/PanelSideBarContext.tsx @@ -108,7 +108,9 @@ export const PanelSideBarProvider = (props: PanelSideBarMenuProvide theme = "light", } = props; - const activePanel = globalItems.find((x) => x.children?.find((y) => (y.children ? y.children.find((s) => s.active) : y.active))); + const activePanel = globalItems.find((x) => + x.children ? x.children.find((y) => (y.children ? y.children.find((s) => s.active) : y.active)) : x.active, + ); const firstActivePanel = activePanel ?? globalItems.find((x) => x.id); const getActivePanelId = () => localItems?.at(0)?.id ?? firstActivePanel?.id ?? "";