refactor: 페이지 이동 후 복귀 시 canvas 표출이 안되는 현상 수정
This commit is contained in:
parent
594a1abbb1
commit
ab3aa6d993
@ -29,7 +29,7 @@ export default function CanvasFrame({ plan }) {
|
||||
|
||||
useEffect(() => {
|
||||
loadCanvas()
|
||||
}, [plan])
|
||||
}, [plan, canvas])
|
||||
|
||||
useEffect(() => {
|
||||
switch (currentMenu) {
|
||||
|
||||
@ -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') + `</br>${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 (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user