Skip to content

Commit 6b451ce

Browse files
Fix of selection of active item (#52)
Fix of selection of active item
1 parent c4d6e9a commit 6b451ce

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Selection of active panel when `active` is provided to main navigation items.
13+
1014
## [3.2.0] - 2024-01-24
1115

1216
### Added

src/lib/Layout/PanelSideBarLayout/PanelSideBar/Context/PanelSideBarContext.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ export const PanelSideBarProvider = <TPanelItem,>(props: PanelSideBarMenuProvide
108108
theme = "light",
109109
} = props;
110110

111-
const activePanel = globalItems.find((x) => x.children?.find((y) => (y.children ? y.children.find((s) => s.active) : y.active)));
111+
const activePanel = globalItems.find((x) =>
112+
x.children ? x.children.find((y) => (y.children ? y.children.find((s) => s.active) : y.active)) : x.active,
113+
);
112114
const firstActivePanel = activePanel ?? globalItems.find((x) => x.id);
113115

114116
const getActivePanelId = () => localItems?.at(0)?.id ?? firstActivePanel?.id ?? "";

0 commit comments

Comments
 (0)