Skip to content

Commit

Permalink
Merge pull request meshery#8877 from Jougan-0/selection-in-nav
Browse files Browse the repository at this point in the history
Fix for Navigation
  • Loading branch information
theBeginner86 authored Sep 25, 2023
2 parents 3903685 + e74adb6 commit d9a90e3
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions ui/components/Navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -806,15 +806,16 @@ class Navigator extends React.Component {
* Removes id from openitems if present
* Adds id in openitems if not present already
*/
toggleItemCollapse(id) {
toggleItemCollapse = (itemId) => {
const isItemOpen = this.state.openItems.includes(itemId);
const activeItems = [...this.state.openItems];
if (this.state.openItems.includes(id)) {
this.setState({ openItems: activeItems.filter((item) => item !== id) });
if (isItemOpen) {
this.setState({ openItems: activeItems.filter((item) => item !== itemId) });
} else {
activeItems.push(id);
this.setState({ openItems: activeItems });
activeItems.push(itemId);
this.setState({ openItems: [itemId] });
}
}
};

/**
* @param {String} idname
Expand Down

0 comments on commit d9a90e3

Please sign in to comment.