diff --git a/src/components/floor-plan/modal/roofAllocation/ContextRoofAllocationSetting.jsx b/src/components/floor-plan/modal/roofAllocation/ContextRoofAllocationSetting.jsx
index 2ce64be7..78597844 100644
--- a/src/components/floor-plan/modal/roofAllocation/ContextRoofAllocationSetting.jsx
+++ b/src/components/floor-plan/modal/roofAllocation/ContextRoofAllocationSetting.jsx
@@ -86,7 +86,7 @@ export default function ContextRoofAllocationSetting(props) {
return (
-
+
{pitchText}
diff --git a/src/components/floor-plan/modal/roofAllocation/RoofAllocationSetting.jsx b/src/components/floor-plan/modal/roofAllocation/RoofAllocationSetting.jsx
index 32364844..0e0e09ee 100644
--- a/src/components/floor-plan/modal/roofAllocation/RoofAllocationSetting.jsx
+++ b/src/components/floor-plan/modal/roofAllocation/RoofAllocationSetting.jsx
@@ -86,7 +86,7 @@ export default function RoofAllocationSetting(props) {
return (
{pitchText}
diff --git a/src/hooks/roofcover/useRoofAllocationSetting.js b/src/hooks/roofcover/useRoofAllocationSetting.js
index 3fef0ee9..e6d7a825 100644
--- a/src/hooks/roofcover/useRoofAllocationSetting.js
+++ b/src/hooks/roofcover/useRoofAllocationSetting.js
@@ -174,22 +174,32 @@ export function useRoofAllocationSetting(id) {
})
}
+ const firstRes = Array.isArray(res) && res.length > 0 ? res[0] : null
+
setBasicSetting({
...basicSetting,
- planNo: res[0].planNo,
- roofSizeSet: res[0].roofSizeSet,
- roofAngleSet: res[0].roofAngleSet,
+ planNo: firstRes?.planNo ?? planNo,
+ roofSizeSet: firstRes?.roofSizeSet ?? 0,
+ roofAngleSet: firstRes?.roofAngleSet ?? 0,
roofsData: roofsArray,
selectedRoofMaterial: selectRoofs.find((roof) => roof.selected),
})
setBasicInfo({
- planNo: '' + res[0].planNo,
- roofSizeSet: '' + res[0].roofSizeSet,
- roofAngleSet: '' + res[0].roofAngleSet,
+ planNo: '' + (firstRes?.planNo ?? planNo),
+ roofSizeSet: '' + (firstRes?.roofSizeSet ?? 0),
+ roofAngleSet: '' + (firstRes?.roofAngleSet ?? 0),
})
- //데이터 동기화
- setCurrentRoofList(selectRoofs)
+ // 데이터 동기화: 렌더링용 필드 기본값 보정
+ const normalizedRoofs = selectRoofs.map((roof) => ({
+ ...roof,
+ width: roof.width ?? '',
+ length: roof.length ?? '',
+ hajebichi: roof.hajebichi ?? '',
+ pitch: roof.pitch ?? '',
+ angle: roof.angle ?? '',
+ }))
+ setCurrentRoofList(normalizedRoofs)
})
} catch (error) {
console.error('Data fetching error:', error)