diff --git a/src/hooks/roofcover/useRoofAllocationSetting.js b/src/hooks/roofcover/useRoofAllocationSetting.js index 2b9c9494..a8caf5ce 100644 --- a/src/hooks/roofcover/useRoofAllocationSetting.js +++ b/src/hooks/roofcover/useRoofAllocationSetting.js @@ -248,16 +248,22 @@ export function useRoofAllocationSetting(id) { swalFire({ type: 'alert', icon: 'error', text: getMessage('roof.exceed.count') }) return } - setCurrentRoofList([ - ...currentRoofList, - { - ...currentRoofMaterial, + + const originCurrentRoofList = currentRoofList.map((roof) => { + return { + ...roof, selected: false, - id: currentRoofMaterial.roofMatlCd, - name: currentRoofMaterial.roofMatlNm, - index: currentRoofList.length, - }, - ]) + } + }) + originCurrentRoofList.push({ + ...currentRoofMaterial, + selected: true, + id: currentRoofMaterial.roofMatlCd, + name: currentRoofMaterial.roofMatlNm, + index: currentRoofList.length, + }) + + setCurrentRoofList(originCurrentRoofList) } /**