From 69065b77d59bcfcbbf70639894b48623c2e0224a Mon Sep 17 00:00:00 2001 From: Maxime Bajeux Date: Fri, 20 Dec 2024 10:06:36 +0100 Subject: [PATCH] fix(pnr): resolve routing undefined error (#14572) ref: MANAGER-16441 Signed-off-by: Maxime Bajeux --- .../src/container/nav-reshuffle/sidebar/index.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/index.tsx b/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/index.tsx index 5e61bb41b2e2..b82818f51e6d 100644 --- a/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/index.tsx +++ b/packages/manager/apps/container/src/container/nav-reshuffle/sidebar/index.tsx @@ -125,7 +125,9 @@ const Sidebar = (): JSX.Element => { } const currentNode: Node = selectedSubMenu || savedNode; - if (currentNode) { + + + if (currentNode?.routing) { // We already stored a node, we want to know if it stills in coherence with the current path // If not, we reset the node to null to not keep wrong information. const universe = findNodeById(currentNavigationNode, currentNode.universe); @@ -154,14 +156,11 @@ const Sidebar = (): JSX.Element => { selectLvl1Node(universe) return; - } else { - selectedNode ? selectLvl1Node(null) : setSavedNode(null); } - } else { - selectedNode ? selectLvl1Node(null) : setSavedNode(null); } } - + selectedNode ? selectLvl1Node(null) : setSavedNode(null); + // If we didn't have a stored node or if we have reset it, // we search in the full navigation tree a node that could match the current path const foundNode = findNodeByRouting(currentNavigationNode, pathname);