mirror of
https://github.com/hexastack/hexabot
synced 2025-02-23 04:48:51 +00:00
fix: reset onclose
This commit is contained in:
parent
d563530ccf
commit
89d8fae613
@ -110,12 +110,14 @@ export const ContentTypeDialog: FC<ContentTypeDialogProps> = ({
|
||||
}, [open, reset]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
|
||||
if (data) {
|
||||
reset({
|
||||
name: data.name,
|
||||
fields: data.fields || [],
|
||||
fields: data.fields?.length ? data.fields : FIELDS_FORM_DEFAULT_VALUES,
|
||||
});
|
||||
replace(data.fields || FIELDS_FORM_DEFAULT_VALUES);
|
||||
replace(data.fields?.length ? data.fields : FIELDS_FORM_DEFAULT_VALUES);
|
||||
} else {
|
||||
reset({ name: "", fields: FIELDS_FORM_DEFAULT_VALUES });
|
||||
replace(FIELDS_FORM_DEFAULT_VALUES);
|
||||
@ -173,7 +175,7 @@ export const ContentTypeDialog: FC<ContentTypeDialogProps> = ({
|
||||
</ContentContainer>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<DialogButtons closeDialog={closeDialog} />
|
||||
<DialogButtons closeDialog={closeAndReset} />
|
||||
</DialogActions>
|
||||
</form>
|
||||
</Dialog>
|
||||
|
Loading…
Reference in New Issue
Block a user