mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
optimizations
This commit is contained in:
@@ -39,20 +39,13 @@ const ModulesDialog = ({
|
||||
|
||||
const updateFormValue = updateValue(setEditItem);
|
||||
|
||||
// Sync form state when dialog opens or selected item changes
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
setEditItem(selectedItem);
|
||||
}
|
||||
}, [open, selectedItem]);
|
||||
|
||||
const close = () => {
|
||||
onClose();
|
||||
};
|
||||
|
||||
const save = () => {
|
||||
onSave(editItem);
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog sx={dialogStyle} fullWidth maxWidth="xs" open={open} onClose={onClose}>
|
||||
<DialogTitle>{LL.EDIT() + ' ' + editItem.key}</DialogTitle>
|
||||
@@ -85,7 +78,7 @@ const ModulesDialog = ({
|
||||
<Button
|
||||
startIcon={<CancelIcon />}
|
||||
variant="outlined"
|
||||
onClick={close}
|
||||
onClick={onClose}
|
||||
color="secondary"
|
||||
>
|
||||
{LL.CANCEL()}
|
||||
@@ -93,7 +86,7 @@ const ModulesDialog = ({
|
||||
<Button
|
||||
startIcon={<DoneIcon />}
|
||||
variant="outlined"
|
||||
onClick={save}
|
||||
onClick={() => onSave(editItem)}
|
||||
color="primary"
|
||||
>
|
||||
{LL.UPDATE()}
|
||||
|
||||
Reference in New Issue
Block a user