diff --git a/frontend/src/components/content-types/ContentTypeForm.tsx b/frontend/src/components/content-types/ContentTypeForm.tsx index 256ff2a9..cf819f07 100644 --- a/frontend/src/components/content-types/ContentTypeForm.tsx +++ b/frontend/src/components/content-types/ContentTypeForm.tsx @@ -8,7 +8,7 @@ import AddIcon from "@mui/icons-material/Add"; import { Button } from "@mui/material"; -import { FC, Fragment, useMemo } from "react"; +import { FC, Fragment } from "react"; import { useFieldArray, useForm } from "react-hook-form"; import { ContentContainer, ContentItem } from "@/app-components/dialogs"; @@ -24,29 +24,17 @@ import { IContentType, IContentTypeAttributes, } from "@/types/content-type.types"; -import { generateId } from "@/utils/generateId"; import { slugify } from "@/utils/string"; import { FieldInput } from "./components/FieldInput"; import { FIELDS_FORM_DEFAULT_VALUES } from "./constants"; export const ContentTypeForm: FC> = ({ - data: { defaultValues: contentTypeWithoutUuid }, + data: { defaultValues: contentType }, Wrapper = Fragment, WrapperProps, ...rest }) => { - const contentType = useMemo( - () => - contentTypeWithoutUuid && { - ...contentTypeWithoutUuid, - fields: contentTypeWithoutUuid?.fields?.map((field) => ({ - ...field, - uuid: generateId(), - })), - }, - [contentTypeWithoutUuid], - ); const { toast } = useToast(); const { t } = useTranslate(); const { @@ -140,7 +128,7 @@ export const ContentTypeForm: FC> = ({ control={control} onLabelChange={(value) => { const fieldName = contentType?.fields?.find( - ({ uuid }) => uuid === field.uuid, + ({ name }) => name === field.name, )?.name; if (!fieldName) { diff --git a/frontend/src/types/content-type.types.ts b/frontend/src/types/content-type.types.ts index 83d988b9..251f6b16 100644 --- a/frontend/src/types/content-type.types.ts +++ b/frontend/src/types/content-type.types.ts @@ -23,7 +23,6 @@ export type ContentField = { name: string; label: string; type: ContentFieldType; - uuid?: string; }; export interface IContentTypeAttributes {