fix: getCurrentMenu 로직 수정

This commit is contained in:
2025-03-31 18:23:46 +09:00
parent ea319aa5ab
commit 67d57e3060
+7 -6
View File
@@ -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;
};