fix(EditNodeModal): only reset data and call onClose when modalOpen is true to prevent unnecessary side effects
This commit is contained in:
parent
6f40a94b55
commit
27bc4c5498
1 changed files with 4 additions and 2 deletions
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue