diff --git a/src/components/floor-plan/CanvasFrame.jsx b/src/components/floor-plan/CanvasFrame.jsx index 3b823460..17f0018d 100644 --- a/src/components/floor-plan/CanvasFrame.jsx +++ b/src/components/floor-plan/CanvasFrame.jsx @@ -29,7 +29,7 @@ export default function CanvasFrame({ plan }) { useEffect(() => { loadCanvas() - }, [plan]) + }, [plan, canvas]) useEffect(() => { switch (currentMenu) { diff --git a/src/components/floor-plan/CanvasLayout.jsx b/src/components/floor-plan/CanvasLayout.jsx index 7a3e9323..62cc737b 100644 --- a/src/components/floor-plan/CanvasLayout.jsx +++ b/src/components/floor-plan/CanvasLayout.jsx @@ -25,8 +25,7 @@ export default function CanvasLayout() { const handleCurrentPlan = (newCurrentId) => { // console.log('currentPlan newCurrentId: ', newCurrentId) - - if (!currentCanvasPlan?.id || currentCanvasPlan.id !== newCurrentId) { + if (!currentCanvasPlan || currentCanvasPlan.id !== newCurrentId) { if (currentCanvasPlan?.id && checkModifiedCanvasPlan()) { swalFire({ html: getMessage('common.message.confirm.save') + `
${currentCanvasPlan.name}`, @@ -92,17 +91,19 @@ export default function CanvasLayout() { } useEffect(() => { - getCanvasByObjectNo(sessionState.userId, objectNo).then((res) => { - console.log('canvas 목록 ', res) - if (res.length > 0) { - setInitCanvasPlans(res) - setPlans(res) - handleCurrentPlan(res.at(-1).id) // last 데이터에 포커싱 - setPlanNum(res.length) - } else { - addNewPlan() - } - }) + if (!currentCanvasPlan) { + getCanvasByObjectNo(sessionState.userId, objectNo).then((res) => { + // console.log('canvas 목록 ', res) + if (res.length > 0) { + setInitCanvasPlans(res) + setPlans(res) + handleCurrentPlan(res.at(-1).id) // last 데이터에 포커싱 + setPlanNum(res.length) + } else { + addNewPlan() + } + }) + } }, []) return (