diff --git a/frontend/src/components/content-types/ContentTypeDialog.tsx b/frontend/src/components/content-types/ContentTypeDialog.tsx index c8d05703..c53a093e 100644 --- a/frontend/src/components/content-types/ContentTypeDialog.tsx +++ b/frontend/src/components/content-types/ContentTypeDialog.tsx @@ -56,21 +56,6 @@ export const ContentTypeDialog: FC = ({ closeDialog(); reset(); }; - - useEffect(() => { - if (open) reset(); - }, [open, reset]); - - useEffect(() => { - if (data) { - reset({ - name: data.name, - }); - } else { - reset(); - } - }, [data, reset]); - const { mutate: createContentType } = useCreate(EntityType.CONTENT_TYPE, { onError: (error) => { toast.error(error); @@ -96,10 +81,24 @@ export const ContentTypeDialog: FC = ({ if (data) { updateContentType({ id: data.id, params }); } else { - createContentType({ ...params, name: params.name || "" }); + createContentType(params); } }; + useEffect(() => { + if (open) reset(); + }, [open, reset]); + + useEffect(() => { + if (data) { + reset({ + name: data.name, + }); + } else { + reset(); + } + }, [data, reset]); + return (