diff --git a/src/components/floor-plan/modal/basic/step/Trestle.jsx b/src/components/floor-plan/modal/basic/step/Trestle.jsx
index dd2e64ca..98a4c4ee 100644
--- a/src/components/floor-plan/modal/basic/step/Trestle.jsx
+++ b/src/components/floor-plan/modal/basic/step/Trestle.jsx
@@ -217,7 +217,7 @@ const Trestle = forwardRef((props, ref) => {
}, [constructionList, autoSelectStep])
const getConstructionState = (index) => {
- if (constructionList && constructionList.length > 0) {
+ if (index > -1 && constructionList && constructionList.length > 0 && constructionList[index]) {
if (constructionList[index].constPossYn === 'Y') {
if (trestleState && trestleState.constTp === constructionList[index].constTp) {
return 'blue'
@@ -865,21 +865,23 @@ const Trestle = forwardRef((props, ref) => {
-
-
-
-
-
+ {/* 2026-06-05 공법 버튼을 배열 인덱스 대신 constTp로 매핑 — API 응답 항목 추가/순서변경(예: 標準施工(II) WORK_LV_ID_-2) 시 인덱스 밀림 방지. 운영(구 API)엔 -2가 없어 optional 은 데이터 있을 때만 렌더 */}
+ {[
+ { constTp: 'WORK_LV_ID_-1', label: `${getMessage('modal.module.basic.setting.module.standard.construction')}(I)` },
+ { constTp: 'WORK_LV_ID_-2', label: `${getMessage('modal.module.basic.setting.module.standard.construction')}(II)`, optional: true },
+ { constTp: 'WORK_LV_ID_1', label: getMessage('modal.module.basic.setting.module.standard.construction') },
+ { constTp: 'WORK_LV_ID_3', label: getMessage('modal.module.basic.setting.module.enforce.construction') },
+ { constTp: 'WORK_LV_ID_4', label: getMessage('modal.module.basic.setting.module.multiple.construction') },
+ { constTp: 'WORK_LV_ID_5', label: `${getMessage('modal.module.basic.setting.module.multiple.construction')}(II)` },
+ ].map(({ constTp, label, optional }) => {
+ const index = constructionList.findIndex((c) => c.constTp === constTp)
+ if (optional && index === -1) return null
+ return (
+
+ )
+ })}
diff --git a/src/hooks/module/useModuleTabContents.js b/src/hooks/module/useModuleTabContents.js
index 5f82f939..7fe24f64 100644
--- a/src/hooks/module/useModuleTabContents.js
+++ b/src/hooks/module/useModuleTabContents.js
@@ -175,9 +175,10 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
isObjectNotEmpty(moduleConstructionSelectionData?.construction) &&
moduleConstructionSelectionData?.construction.hasOwnProperty('constPossYn') ///키가 있으면
) {
- const selectedIndex = moduleConstructionSelectionData.construction.selectedIndex
- const construction = constructionList[selectedIndex]
- if (construction.constPossYn === 'Y') {
+ // 2026-06-05 저장값 복원도 constTp 기준 — 항목 추가/순서변경으로 selectedIndex 가 어긋나는 문제 방지
+ const selectedIndex = constructionList.findIndex((c) => c.constTp === moduleConstructionSelectionData.construction.constTp)
+ const construction = selectedIndex > -1 ? constructionList[selectedIndex] : null
+ if (construction && construction.constPossYn === 'Y') {
handleConstruction(selectedIndex)
}
}
@@ -268,7 +269,7 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
const handleConstruction = (index) => {
if (index > -1) {
const isPossibleIndex = constructionRef.current
- .map((el, i) => (el.classList.contains('white') || el.classList.contains('blue') ? i : -1))
+ .map((el, i) => (el && (el.classList.contains('white') || el.classList.contains('blue')) ? i : -1))
.filter((index) => index !== -1)
isPossibleIndex.forEach((index) => {
@@ -341,7 +342,7 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
setSelectedConstruction(selectedConstruction)
} else {
constructionRef.current.forEach((ref) => {
- ref.classList.remove('blue')
+ if (ref) ref.classList.remove('blue')
})
}
}