Skip to content

Commit

Permalink
Fix Routing Forms being selected with Apps
Browse files Browse the repository at this point in the history
  • Loading branch information
hariombalhara committed Sep 12, 2022
1 parent 03a4a7c commit 52e8b02
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions packages/ui/v2/core/Shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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/");
},
},
],
Expand Down Expand Up @@ -543,7 +555,6 @@ const NavigationItem: React.FC<{
</Link>
{item.child &&
isCurrent({ router, isChild, item }) &&
router.asPath.startsWith(item.href) &&
item.child.map((item) => <NavigationItem key={item.name} item={item} isChild />)}
</Fragment>
);
Expand Down

0 comments on commit 52e8b02

Please sign in to comment.