From 9278d548d10a2b44ffedc440e7ed098324134cee Mon Sep 17 00:00:00 2001 From: Jougan-0 Date: Sat, 23 Sep 2023 01:09:34 +0530 Subject: [PATCH] Fix for Navigation w/signoff Signed-off-by: Jougan-0 --- ui/components/Navigator.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ui/components/Navigator.js b/ui/components/Navigator.js index b40f70f2d7c..2095e2a25bb 100644 --- a/ui/components/Navigator.js +++ b/ui/components/Navigator.js @@ -779,13 +779,14 @@ 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) }) - } else { - activeItems.push(id); - this.setState({ openItems : activeItems }) + if (isItemOpen) { + this.setState({ openItems : activeItems.filter(item => item !== itemId) }); + } else { + activeItems.push(itemId); + this.setState({ openItems : [itemId] }); } }