From 2797ec210e33cf7a653cdfad6166ae9b5aed23f8 Mon Sep 17 00:00:00 2001 From: bicochan Date: Mon, 7 Apr 2025 17:38:37 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20getCurrentMenu=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/cs/src/entities/menu/lib/utils.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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; };