diff --git a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx index 9235ee8d..f2bb0103 100644 --- a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx +++ b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx @@ -59,11 +59,11 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set if (!basicSetting || !currentRoof || Object.keys(currentRoof).length === 0 || Object.keys(basicSetting).length === 0) return const raftCodeList = findCommonCode('203800') setRaftCodes(raftCodeList) - - if (addedRoofs.length > 0) { - setCurrentRoof({ ...currentRoof, roofSizeSet: addedRoofs[0].roofSizeSet, roofAngleSet: addedRoofs[0].roofAngleSet }) - } else if (basicSetting.roofSizeSet.length > 0) { - setCurrentRoof({ ...currentRoof, roofSizeSet: basicSetting.roofSizeSet, roofAngleSet: basicSetting.roofAngleSet }) + + if (addedRoofs[0].roofAngleSet && addedRoofs[0].roofAngleSet?.length > 0) { + setCurrentRoof({ ...currentRoof, roofSizeSet: String(addedRoofs[0].roofSizeSet), roofAngleSet: addedRoofs[0].roofAngleSet }) + } else if (basicSetting.roofAngleSet && basicSetting.roofAngleSet?.length > 0) { + setCurrentRoof({ ...currentRoof, roofSizeSet: String(basicSetting.roofSizeSet), roofAngleSet: basicSetting.roofAngleSet }) } }, []) diff --git a/src/hooks/roofcover/useRoofAllocationSetting.js b/src/hooks/roofcover/useRoofAllocationSetting.js index 3b956843..39487361 100644 --- a/src/hooks/roofcover/useRoofAllocationSetting.js +++ b/src/hooks/roofcover/useRoofAllocationSetting.js @@ -156,7 +156,13 @@ export function useRoofAllocationSetting(id) { } setCurrentRoofList(selectRoofs) - setBasicSetting({ ...basicSetting, roofsData: roofsArray }) + //setBasicSetting({ ...basicSetting, roofsData: roofsArray }) + setBasicSetting({ + ...basicSetting, + roofSizeSet: res[0].roofSizeSet, + roofAngleSet: res[0].roofAngleSet, + roofsData: roofsArray, + }) }) } catch (error) { console.error('Data fetching error:', error)