improve key selection

This commit is contained in:
SrGooglo 2024-09-15 03:34:54 +00:00
parent 4fcadcd241
commit 4d91eccab2

View File

@ -168,8 +168,10 @@ export default class Sidebar extends React.Component {
}
calculateSelectedMenuItem = (path) => {
const items = [...this.state.topItems, ...this.state.bottomItems]
this.setState({
selectedMenuItem: [...this.state.topItems, ...this.state.bottomItems].find((item) => item.path === path)
selectedMenuItem: items.find((item) => String(item.path).includes(path)),
})
}
@ -352,7 +354,7 @@ export default class Sidebar extends React.Component {
}
render() {
const selectedKeyId = this.state.selectedMenuItem?.id ?? "home"
const selectedKeyId = this.state.selectedMenuItem?.id
return <div
className="app_sidebar_wrapper"