From 1b9604f66eaff09b05e3a18e6cbbc65835f86b76 Mon Sep 17 00:00:00 2001 From: johngreen Date: Mon, 11 May 2026 13:03:05 +0900 Subject: [PATCH] =?UTF-8?q?fix(layout):=20=EB=B6=80=EC=84=9C=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20=ED=83=AD=20=EB=9D=BC=EB=B2=A8=20hardcoded=20?= =?UTF-8?q?=ED=95=9C=EA=B8=80=20fallback=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SUPER_ADMIN cross-tenant 모드에서 menu API (/api/admin/menus) 가 500 응답을 내어 uiMenus 가 비어있고, 그 결과 우리 effect 가 매칭할 데이터가 없어 sessionStorage 의 영어 fallback title (deptMngList) 이 갱신되지 않던 문제. AppLayout 의 fallback 두 곳에 ADMIN_PATH_LABELS 맵 추가: 1. URL 직접 진입 시 첫 openTab 의 fallback title 2. uiMenus 매칭 실패 시 한글 라벨 보강 근본 원인 (menu API 500) 은 별도 backend 이슈 — 본 fix 는 우회. Co-Authored-By: Claude Opus 4.7 (1M context) --- frontend/components/layout/AppLayout.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/frontend/components/layout/AppLayout.tsx b/frontend/components/layout/AppLayout.tsx index 0ceb247b..02c7564f 100644 --- a/frontend/components/layout/AppLayout.tsx +++ b/frontend/components/layout/AppLayout.tsx @@ -409,7 +409,12 @@ function AppLayoutInner({ children }: AppLayoutProps) { if (pathname.startsWith("/admin") && pathname !== "/admin") { store.setMode("admin"); - store.openTab({ type: "admin", title: pathname.split("/").pop() || "관리자", admin_url: pathname }); + // menu API 가 실패하는 환경 (SUPER_ADMIN cross-tenant 등) 에서도 한글 라벨 유지 + const ADMIN_PATH_LABELS: Record = { + "/admin/userMng/deptMngList": "부서관리", + }; + const fallbackTitle = ADMIN_PATH_LABELS[pathname] || pathname.split("/").pop() || "관리자"; + store.openTab({ type: "admin", title: fallbackTitle, admin_url: pathname }); } }, []); @@ -903,15 +908,18 @@ function AppLayoutInner({ children }: AppLayoutProps) { }, [activeTab, uiMenus, isMenuActive]); // URL 직접 진입 / sessionStorage 복원 시 admin 탭의 영어 path-segment title 을 - // menu_name_kor (uiMenus 의 tabTitle/label/name) 로 한 번만 갱신. + // menu_name_kor (uiMenus 의 tabTitle/label/name) 로 갱신. + // menu API 가 실패한 환경 (SUPER_ADMIN cross-tenant) 에서도 동작하도록 hardcoded map 도 같이 검사. useEffect(() => { - if (uiMenus.length === 0) return; + const ADMIN_PATH_LABELS: Record = { + "/admin/userMng/deptMngList": "부서관리", + }; const store = useTabStore.getState(); for (const tab of store.admin.tabs) { if (tab.type !== "admin" || !tab.admin_url) continue; const matched = uiMenus.find((m: any) => m.url === tab.admin_url); const koreanTitle: string | undefined = - matched?.tabTitle || matched?.label || matched?.name; + matched?.tabTitle || matched?.label || matched?.name || ADMIN_PATH_LABELS[tab.admin_url]; if (koreanTitle && tab.title !== koreanTitle) { store.updateTabTitle(tab.id, koreanTitle); }