From e5abd93600266ad26be242562649da559ce9be8d Mon Sep 17 00:00:00 2001 From: SeongHyun Kim Date: Wed, 4 Mar 2026 14:40:48 +0900 Subject: [PATCH] =?UTF-8?q?fix(pop):=20=EC=B9=B4=ED=85=8C=EA=B3=A0?= =?UTF-8?q?=EB=A6=AC=20=ED=8A=B8=EB=A6=AC=20=EC=A0=91=EA=B8=B0/=ED=8E=BC?= =?UTF-8?q?=EC=B9=98=EA=B8=B0=20=EC=83=81=ED=83=9C=EB=A5=BC=20sessionStora?= =?UTF-8?q?ge=EB=A1=9C=20=EC=9C=A0=EC=A7=80=20=EC=84=A4=EA=B3=84=20?= =?UTF-8?q?=ED=99=94=EB=A9=B4=EC=97=90=20=EC=A7=84=EC=9E=85=ED=96=88?= =?UTF-8?q?=EB=8B=A4=20=EB=8F=8C=EC=95=84=EC=98=AC=20=EB=95=8C=20=EC=B9=B4?= =?UTF-8?q?=ED=85=8C=EA=B3=A0=EB=A6=AC=20=ED=8A=B8=EB=A6=AC=EC=99=80=20?= =?UTF-8?q?=EB=AF=B8=EB=B6=84=EB=A5=98=20=ED=9A=8C=EC=82=AC=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=A0=91=EA=B8=B0/=ED=8E=BC=EC=B9=98=EA=B8=B0=20?= =?UTF-8?q?=EC=83=81=ED=83=9C=EA=B0=80=20=EC=B4=88=EA=B8=B0=ED=99=94?= =?UTF-8?q?=EB=90=98=EB=8A=94=20=EB=AC=B8=EC=A0=9C=EB=A5=BC=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=ED=95=9C=EB=8B=A4.=20expandedGroups,=20expandedCompan?= =?UTF-8?q?yCodes=EB=A5=BC=20sessionStorage=EC=97=90=20=EC=A0=80=EC=9E=A5?= =?UTF-8?q?=ED=95=98=EC=97=AC=20=EA=B0=99=EC=9D=80=20=ED=83=AD=20=EC=84=B8?= =?UTF-8?q?=EC=85=98=20=EB=82=B4=EC=97=90=EC=84=9C=20=EC=83=81=ED=83=9C?= =?UTF-8?q?=EA=B0=80=20=EC=9C=A0=EC=A7=80=EB=90=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pop/management/PopCategoryTree.tsx | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/frontend/components/pop/management/PopCategoryTree.tsx b/frontend/components/pop/management/PopCategoryTree.tsx index 705d7163..37e4f0ba 100644 --- a/frontend/components/pop/management/PopCategoryTree.tsx +++ b/frontend/components/pop/management/PopCategoryTree.tsx @@ -471,7 +471,15 @@ export function PopCategoryTree({ // 상태 관리 const [groups, setGroups] = useState([]); const [loading, setLoading] = useState(true); - const [expandedGroups, setExpandedGroups] = useState>(new Set()); + const [expandedGroups, setExpandedGroups] = useState>(() => { + if (typeof window === "undefined") return new Set(); + try { + const saved = sessionStorage.getItem("pop-tree-expanded-groups"); + return saved ? new Set(JSON.parse(saved) as number[]) : new Set(); + } catch { + return new Set(); + } + }); const [selectedGroupId, setSelectedGroupId] = useState(null); // 그룹 모달 상태 @@ -500,7 +508,15 @@ export function PopCategoryTree({ const [moveSearchTerm, setMoveSearchTerm] = useState(""); // 미분류 회사코드별 접기/펼치기 - const [expandedCompanyCodes, setExpandedCompanyCodes] = useState>(new Set()); + const [expandedCompanyCodes, setExpandedCompanyCodes] = useState>(() => { + if (typeof window === "undefined") return new Set(); + try { + const saved = sessionStorage.getItem("pop-tree-expanded-companies"); + return saved ? new Set(JSON.parse(saved) as string[]) : new Set(); + } catch { + return new Set(); + } + }); // 화면 맵 생성 (screen_id로 빠르게 조회) const screensMap = useMemo(() => { @@ -544,6 +560,9 @@ export function PopCategoryTree({ } else { next.add(groupId); } + try { + sessionStorage.setItem("pop-tree-expanded-groups", JSON.stringify([...next])); + } catch { /* noop */ } return next; }); }; @@ -1013,6 +1032,9 @@ export function PopCategoryTree({ } else { next.add(code); } + try { + sessionStorage.setItem("pop-tree-expanded-companies", JSON.stringify([...next])); + } catch { /* noop */ } return next; }); };