From a4473eee3343128b62974ee8bc6563b1361fe3fe Mon Sep 17 00:00:00 2001 From: dohyeons Date: Thu, 23 Oct 2025 12:54:46 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A0=81=EC=9A=A9=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EB=88=8C=EB=A0=80=EC=9D=84=20=EB=95=8C=20=EC=B4=88=EA=B8=B0=20?= =?UTF-8?q?=EC=9C=84=EC=B9=98,=20=EC=B4=88=EA=B8=B0=20=ED=81=AC=EA=B8=B0?= =?UTF-8?q?=EB=A1=9C=20=EB=90=98=EB=8F=8C=EC=95=84=EA=B0=80=EB=8A=94=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/dashboard/DashboardDesigner.tsx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/frontend/components/admin/dashboard/DashboardDesigner.tsx b/frontend/components/admin/dashboard/DashboardDesigner.tsx index ee90063c..7d7e3cd6 100644 --- a/frontend/components/admin/dashboard/DashboardDesigner.tsx +++ b/frontend/components/admin/dashboard/DashboardDesigner.tsx @@ -392,12 +392,21 @@ export default function DashboardDesigner({ dashboardId: initialDashboardId }: D // 사이드바 적용 const handleApplySidebar = useCallback( (updatedElement: DashboardElement) => { - updateElement(updatedElement.id, updatedElement); - // 사이드바는 열린 채로 유지하여 연속 수정 가능 - // 단, sidebarElement도 업데이트해서 최신 상태 반영 - setSidebarElement(updatedElement); + // 현재 요소의 최신 상태를 가져와서 position과 size는 유지 + const currentElement = elements.find((el) => el.id === updatedElement.id); + if (currentElement) { + // position과 size는 현재 상태 유지, 나머지만 업데이트 + const finalElement = { + ...updatedElement, + position: currentElement.position, + size: currentElement.size, + }; + updateElement(finalElement.id, finalElement); + // 사이드바도 최신 상태로 업데이트 + setSidebarElement(finalElement); + } }, - [updateElement], + [elements, updateElement], ); // 레이아웃 저장