Skip to content

Commit

Permalink
Fix of selection of active item (#52)
Browse files Browse the repository at this point in the history
Fix of selection of active item
  • Loading branch information
Michele-Masciave authored Feb 1, 2024
1 parent c4d6e9a commit 6b451ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ export const PanelSideBarProvider = <TPanelItem,>(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 ?? "";
Expand Down

0 comments on commit 6b451ce

Please sign in to comment.