diff --git a/apps/cs/src/entities/menu/lib/utils.ts b/apps/cs/src/entities/menu/lib/utils.ts index 5606d7aa2..d526b34b4 100644 --- a/apps/cs/src/entities/menu/lib/utils.ts +++ b/apps/cs/src/entities/menu/lib/utils.ts @@ -5,10 +5,12 @@ export const getCurrentMenu = ( pathname: string, ): MenuItem | null => { for (const menu of menus) { - if (menu.children) { - return getCurrentMenu(menu.children, pathname); - } if (menu.urlPath === pathname) return menu; + + if (menu.children) { + const children = getCurrentMenu(menu.children, pathname); + if (children) return children; + } } return null; };