refactor: 페이지 이동 후 복귀 시 canvas 표출이 안되는 현상 수정
This commit is contained in:
parent
594a1abbb1
commit
ab3aa6d993
@ -29,7 +29,7 @@ export default function CanvasFrame({ plan }) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadCanvas()
|
loadCanvas()
|
||||||
}, [plan])
|
}, [plan, canvas])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
switch (currentMenu) {
|
switch (currentMenu) {
|
||||||
|
|||||||
@ -25,8 +25,7 @@ export default function CanvasLayout() {
|
|||||||
|
|
||||||
const handleCurrentPlan = (newCurrentId) => {
|
const handleCurrentPlan = (newCurrentId) => {
|
||||||
// console.log('currentPlan newCurrentId: ', newCurrentId)
|
// console.log('currentPlan newCurrentId: ', newCurrentId)
|
||||||
|
if (!currentCanvasPlan || currentCanvasPlan.id !== newCurrentId) {
|
||||||
if (!currentCanvasPlan?.id || currentCanvasPlan.id !== newCurrentId) {
|
|
||||||
if (currentCanvasPlan?.id && checkModifiedCanvasPlan()) {
|
if (currentCanvasPlan?.id && checkModifiedCanvasPlan()) {
|
||||||
swalFire({
|
swalFire({
|
||||||
html: getMessage('common.message.confirm.save') + `</br>${currentCanvasPlan.name}`,
|
html: getMessage('common.message.confirm.save') + `</br>${currentCanvasPlan.name}`,
|
||||||
@ -92,17 +91,19 @@ export default function CanvasLayout() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getCanvasByObjectNo(sessionState.userId, objectNo).then((res) => {
|
if (!currentCanvasPlan) {
|
||||||
console.log('canvas 목록 ', res)
|
getCanvasByObjectNo(sessionState.userId, objectNo).then((res) => {
|
||||||
if (res.length > 0) {
|
// console.log('canvas 목록 ', res)
|
||||||
setInitCanvasPlans(res)
|
if (res.length > 0) {
|
||||||
setPlans(res)
|
setInitCanvasPlans(res)
|
||||||
handleCurrentPlan(res.at(-1).id) // last 데이터에 포커싱
|
setPlans(res)
|
||||||
setPlanNum(res.length)
|
handleCurrentPlan(res.at(-1).id) // last 데이터에 포커싱
|
||||||
} else {
|
setPlanNum(res.length)
|
||||||
addNewPlan()
|
} else {
|
||||||
}
|
addNewPlan()
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user