세부설정

This commit is contained in:
kjs
2025-10-14 17:40:51 +09:00
parent a2c3737f7a
commit a7de47e7ea
9 changed files with 153 additions and 84 deletions

View File

@@ -464,15 +464,24 @@ export default function ScreenDesigner({ selectedScreen, onBackToList }: ScreenD
return comp;
}
// 중첩 경로를 고려한 안전한 복사
const newComp = { ...comp };
let current: any = newComp;
// 경로를 따라 내려가면서 각 레벨을 새 객체로 복사
let current: any = newComp;
for (let i = 0; i < pathParts.length - 1; i++) {
if (!current[pathParts[i]]) {
current[pathParts[i]] = {};
const key = pathParts[i];
// 다음 레벨이 없거나 객체가 아니면 새 객체 생성
if (!current[key] || typeof current[key] !== "object" || Array.isArray(current[key])) {
current[key] = {};
} else {
// 기존 객체를 복사하여 불변성 유지
current[key] = { ...current[key] };
}
current = current[pathParts[i]];
current = current[key];
}
// 최종 값 설정
current[pathParts[pathParts.length - 1]] = value;
console.log("✅ 컴포넌트 업데이트 완료:", {