fix(EditNodeModal): only reset data and call onClose when modalOpen is true to prevent unnecessary side effects

This commit is contained in:
anovazzi1 2023-10-23 22:47:41 -03:00
commit 27bc4c5498

View file

@ -89,8 +89,10 @@ const EditNodeModal = forwardRef(
}; };
useEffect(() => { useEffect(() => {
myData.current = data; // reset data to what it is on node when opening modal if (modalOpen) {
onClose!(modalOpen); myData.current = data; // reset data to what it is on node when opening modal
onClose!(modalOpen);
}
}, [modalOpen]); }, [modalOpen]);
const [errorDuplicateKey, setErrorDuplicateKey] = useState(false); const [errorDuplicateKey, setErrorDuplicateKey] = useState(false);