사이드바 메뉴 펼침/접힘 무한 루프 수정 + 사용자 메뉴 데이터/아이콘 정비
- AppLayout.tsx: 활성 탭 부모 자동 펼치기 useEffect의 의존성에서 expandedMenus를 제거. collapse 직후 effect가 재실행되며 강제 expand가 일어나 펼침/접힘이 토글되지 않던 문제 해결. 이제 activeTab 변경 시에만 부모 메뉴 자동 펼침, 사용자 토글은 안정적으로 유지됨. - 사용자 메뉴 데이터(DB) 재구성: waceplm 9개 화면 캡처와 1:1 매칭되는 46개 메뉴(루트 사용자 + 10 카테고리 + 35 리프) 재삽입, URL을 `.do` 레거시 → `/COMPANY_16/<카테고리>/<리프>` React 라우트로 통일. - 메뉴 아이콘 매핑: 영업/프로젝트/개발/구매/구매요청/자재/생산/품질/CS/ECR 카테고리 + 35개 리프 각각에 업무 성격에 맞는 lucide-react 아이콘(TrendingUp/FolderKanban/Wrench/ShoppingCart/Send/Boxes/Factory/ShieldCheck 등) 부여. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -685,7 +685,7 @@ function AppLayoutInner({ children }: AppLayoutProps) {
|
||||
|
||||
const uiMenus = user ? convertMenuToUI(currentMenus, user as ExtendedUserInfo) : [];
|
||||
|
||||
// 활성 탭에 해당하는 메뉴가 속한 부모 메뉴 자동 확장
|
||||
// 활성 탭이 바뀔 때만 해당 부모 메뉴 자동 확장 (collapse 후 즉시 재펼침 방지)
|
||||
useEffect(() => {
|
||||
if (!activeTab || uiMenus.length === 0) return;
|
||||
|
||||
@@ -693,19 +693,25 @@ function AppLayoutInner({ children }: AppLayoutProps) {
|
||||
for (const menu of uiMenus) {
|
||||
if (menu.hasChildren && menu.children) {
|
||||
const hasActiveChild = menu.children.some((child: any) => isMenuActive(child));
|
||||
if (hasActiveChild && !expandedMenus.has(menu.id)) {
|
||||
toExpand.push(menu.id);
|
||||
}
|
||||
if (hasActiveChild) toExpand.push(menu.id);
|
||||
}
|
||||
}
|
||||
if (toExpand.length > 0) {
|
||||
setExpandedMenus((prev) => {
|
||||
let changed = false;
|
||||
const next = new Set(prev);
|
||||
toExpand.forEach((id) => next.add(id));
|
||||
return next;
|
||||
toExpand.forEach((id) => {
|
||||
if (!next.has(id)) {
|
||||
next.add(id);
|
||||
changed = true;
|
||||
}
|
||||
});
|
||||
return changed ? next : prev;
|
||||
});
|
||||
}
|
||||
}, [activeTab, uiMenus, isMenuActive, expandedMenus]);
|
||||
// expandedMenus / uiMenus / isMenuActive 는 의존성에서 제외 — 활성 탭 변경 시에만 재평가
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [activeTab?.id]);
|
||||
|
||||
if (!user) {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user