mirror of
https://github.com/hexastack/hexabot
synced 2025-02-23 04:48:51 +00:00
fix: reset form
This commit is contained in:
parent
1b455c9e05
commit
23888c51da
@ -25,7 +25,7 @@ import { EntityType } from "@/services/types";
|
|||||||
import { ContentFieldType, IContentType } from "@/types/content-type.types";
|
import { ContentFieldType, IContentType } from "@/types/content-type.types";
|
||||||
|
|
||||||
import { FieldInput } from "./components/FieldInput";
|
import { FieldInput } from "./components/FieldInput";
|
||||||
import { FIELDS_FORM_DEFAULT_VALUES, READ_ONLY_FIELDS } from "./constants";
|
import { READ_ONLY_FIELDS } from "./constants";
|
||||||
|
|
||||||
export type ContentTypeDialogProps = DialogControlProps<IContentType>;
|
export type ContentTypeDialogProps = DialogControlProps<IContentType>;
|
||||||
export const ContentTypeDialog: FC<ContentTypeDialogProps> = ({
|
export const ContentTypeDialog: FC<ContentTypeDialogProps> = ({
|
||||||
@ -45,7 +45,7 @@ export const ContentTypeDialog: FC<ContentTypeDialogProps> = ({
|
|||||||
} = useForm<Partial<IContentType>>({
|
} = useForm<Partial<IContentType>>({
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
name: data?.name || "",
|
name: data?.name || "",
|
||||||
fields: data?.fields || FIELDS_FORM_DEFAULT_VALUES,
|
fields: data?.fields || [],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const { append, fields, remove } = useFieldArray({
|
const { append, fields, remove } = useFieldArray({
|
||||||
@ -90,7 +90,7 @@ export const ContentTypeDialog: FC<ContentTypeDialogProps> = ({
|
|||||||
if (data) {
|
if (data) {
|
||||||
reset({
|
reset({
|
||||||
name: data.name,
|
name: data.name,
|
||||||
fields: data.fields || FIELDS_FORM_DEFAULT_VALUES,
|
fields: data.fields || [],
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
reset();
|
reset();
|
||||||
|
Loading…
Reference in New Issue
Block a user