Compare commits

..

No commits in common. "a13995dec1f2ee89bbbe488cdc04971ff36a5160" and "1f08fc73f7622cd54b5c4ec7fcdf4323cdec59f6" have entirely different histories.

View File

@ -18,11 +18,6 @@ const Trestle = forwardRef((props, ref) => {
const currentAngleType = useRecoilValue(currentAngleTypeSelector)
const pitchText = useRecoilValue(pitchTextSelector)
const [selectedRoof, setSelectedRoof] = useState(null)
const [isAutoSelecting, setIsAutoSelecting] = useState(false) //
const [autoSelectTimeout, setAutoSelectTimeout] = useState(null) //
const autoSelectTimeoutRef = useRef(null)
// ()
const AUTO_SELECT_TIMEOUT = 700 // API
const {
trestleState,
trestleDetail,
@ -68,7 +63,7 @@ const Trestle = forwardRef((props, ref) => {
useEffect(() => {
if (roofs && roofs.length > 0 && !selectedRoof) {
if (roofs && !selectedRoof) {
console.log("roofs:::::", roofs.length)
setLengthBase(roofs[0].length);
setSelectedRoof(roofs[0])
@ -76,12 +71,12 @@ const Trestle = forwardRef((props, ref) => {
if (selectedRoof && selectedRoof.lenAuth === "C") {
onChangeLength(selectedRoof.length);
}
if (selectedRoof && ["C", "R"].includes(selectedRoof.raftAuth) && roofs && roofs.length > 0) {
if (selectedRoof && ["C", "R"].includes(selectedRoof.raftAuth)) {
onChangeRaftBase(roofs[0]);
}
//
restoreModuleInstArea()
}, [roofs, selectedRoof]) // selectedRoof
}, [roofs])
useEffect(() => {
if (flag && moduleSelectionData) {
@ -166,7 +161,7 @@ const Trestle = forwardRef((props, ref) => {
useEffect(() => {
if (constructionList.length > 0) {
const existingConstruction = constructionList.find((construction) => construction.constTp === trestleState.constTp)
const existingConstruction = constructionList.find((construction) => construction.constTp === trestleState?.construction?.constTp)
if (existingConstruction) {
setSelectedConstruction(existingConstruction)
} else if (autoSelectStep === 'construction') {
@ -257,7 +252,7 @@ const Trestle = forwardRef((props, ref) => {
// () -
setTimeout(() => {
setAutoSelectStep('trestle')
}, AUTO_SELECT_TIMEOUT) // API
}, 500) // API
}
const onChangeHajebichi = (e) => {
@ -287,7 +282,7 @@ const Trestle = forwardRef((props, ref) => {
// () -
setTimeout(() => {
setAutoSelectStep('trestle')
}, AUTO_SELECT_TIMEOUT)
}, 500)
}
const onChangeTrestleMaker = (e) => {
@ -310,7 +305,7 @@ const Trestle = forwardRef((props, ref) => {
// API ()
setTimeout(() => {
setAutoSelectStep('constMthd')
}, AUTO_SELECT_TIMEOUT)
}, 300)
}
const onChangeConstMthd = (e) => {
@ -330,21 +325,10 @@ const Trestle = forwardRef((props, ref) => {
},
})
//
if (autoSelectTimeoutRef.current) {
clearTimeout(autoSelectTimeoutRef.current)
}
//
setIsAutoSelecting(true)
// API ()
const timeoutId = setTimeout(() => {
setTimeout(() => {
setAutoSelectStep('roofBase')
setIsAutoSelecting(false)
}, AUTO_SELECT_TIMEOUT)
autoSelectTimeoutRef.current = timeoutId
}, 300)
}
const onChangeRoofBase = (e) => {
@ -372,7 +356,7 @@ const Trestle = forwardRef((props, ref) => {
// API (construction)
setTimeout(() => {
setAutoSelectStep('construction')
}, AUTO_SELECT_TIMEOUT)
}, 300)
}
const handleConstruction = (index) => {
@ -467,7 +451,7 @@ const Trestle = forwardRef((props, ref) => {
...selectedRoofBase,
},
construction: {
...constructionList.find((data) => newAddedRoofs[index].construction.constTp === data.constTp),
...constructionList.find((data) => data.constTp === trestleState.constTp),
cvrYn,
snowGdPossYn,
cvrChecked,