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(() => {
|
||||
myData.current = data; // reset data to what it is on node when opening modal
|
||||
onClose!(modalOpen);
|
||||
if (modalOpen) {
|
||||
myData.current = data; // reset data to what it is on node when opening modal
|
||||
onClose!(modalOpen);
|
||||
}
|
||||
}, [modalOpen]);
|
||||
|
||||
const [errorDuplicateKey, setErrorDuplicateKey] = useState(false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue