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