From 52e8b02da751610dd281b13fd3c1c0fed4e11316 Mon Sep 17 00:00:00 2001 From: Hariom Balhara Date: Mon, 12 Sep 2022 18:24:53 +0530 Subject: [PATCH] Fix Routing Forms being selected with Apps --- packages/ui/v2/core/Shell.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/ui/v2/core/Shell.tsx b/packages/ui/v2/core/Shell.tsx index cfbe2b004433fb..85e967be5f124c 100644 --- a/packages/ui/v2/core/Shell.tsx +++ b/packages/ui/v2/core/Shell.tsx @@ -419,18 +419,30 @@ const navigation: NavigationItemType[] = [ isCurrent: ({ router, item }) => { const path = router.asPath.split("?")[0]; // During Server rendering path is /v2/apps but on client it becomes /apps(weird..) - return path.startsWith(item.href) || path.startsWith("/v2" + item.href); + return ( + (path.startsWith(item.href) || path.startsWith("/v2" + item.href)) && !path.includes("routing_forms/") + ); }, child: [ { name: "app_store", href: "/apps", + isCurrent: ({ router, item }) => { + const path = router.asPath.split("?")[0]; + // During Server rendering path is /v2/apps but on client it becomes /apps(weird..) + return ( + (path.startsWith(item.href) || path.startsWith("/v2" + item.href)) && + !path.includes("routing_forms/") && + !path.includes("/installed") + ); + }, }, { name: "installed_apps", href: "/apps/installed/calendar", isCurrent: ({ router }) => { - return router.asPath.startsWith("/apps/installed/"); + const path = router.asPath; + return path.startsWith("/apps/installed/") || path.startsWith("/v2/apps/installed/"); }, }, ], @@ -543,7 +555,6 @@ const NavigationItem: React.FC<{ {item.child && isCurrent({ router, isChild, item }) && - router.asPath.startsWith(item.href) && item.child.map((item) => )} );