Skip to content

Commit 29ff062

Browse files
Fix active panel (#41)
1 parent 1504d43 commit 29ff062

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ export interface PanelSideBarMenuProviderProps<TPanelItem, TMenuItem>
6060
export const PanelSideBarProvider = <TPanelItem, TMenuItem>(props: PanelSideBarMenuProviderProps<TPanelItem, TMenuItem>) => {
6161
const { children, globalItems, localItems = [], LinkRenderer, brand = null, footer = null, userDropDownMenu, userDropDownMenuToggle, topBarCustomItems } = props;
6262

63-
const firstActivePanel = globalItems.find(x => x.children
64-
?.find(y => y.children ? y.children.find(s => s.active) : y.active) ?? x.id);
63+
const activePanel = globalItems.find(x => x.children?.find(y => y.children ? y.children.find(s => s.active) : y.active));
64+
const firstActivePanel = activePanel ?? globalItems.find(x => x.id);
6565

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

0 commit comments

Comments
 (0)