mirror of
https://github.com/hexastack/hexabot
synced 2025-02-23 12:59:14 +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]);
|
}, [open, reset]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!open) return;
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
reset({
|
reset({
|
||||||
name: data.name,
|
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 {
|
} else {
|
||||||
reset({ name: "", fields: FIELDS_FORM_DEFAULT_VALUES });
|
reset({ name: "", fields: FIELDS_FORM_DEFAULT_VALUES });
|
||||||
replace(FIELDS_FORM_DEFAULT_VALUES);
|
replace(FIELDS_FORM_DEFAULT_VALUES);
|
||||||
@ -173,7 +175,7 @@ export const ContentTypeDialog: FC<ContentTypeDialogProps> = ({
|
|||||||
</ContentContainer>
|
</ContentContainer>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<DialogButtons closeDialog={closeDialog} />
|
<DialogButtons closeDialog={closeAndReset} />
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</form>
|
</form>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
Loading…
Reference in New Issue
Block a user