From 8d67cf69cd8f5918049cf79fc934f4cde1debe7a Mon Sep 17 00:00:00 2001 From: yassinedorbozgithub Date: Mon, 2 Jun 2025 10:42:13 +0100 Subject: [PATCH] fix(frontend): support contentType default name value --- .../src/components/content-types/ContentTypeForm.tsx | 2 ++ .../components/content-types/components/FieldInput.tsx | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/content-types/ContentTypeForm.tsx b/frontend/src/components/content-types/ContentTypeForm.tsx index 759408e8..da74b069 100644 --- a/frontend/src/components/content-types/ContentTypeForm.tsx +++ b/frontend/src/components/content-types/ContentTypeForm.tsx @@ -130,6 +130,8 @@ export const ContentTypeForm: FC> = ({ gap={2} > >; setValue: UseFormSetValue>; + defaultLabel?: string; + defaultName?: string; }) => { const { t } = useTranslate(); const label = useWatch({ @@ -41,7 +45,11 @@ export const FieldInput = ({ }); useEffect(() => { - setValue(`fields.${index}.name`, label ? slugify(label) : ""); + if (defaultLabel && defaultName !== slugify(defaultLabel)) { + defaultName && setValue(`fields.${index}.name`, defaultName); + } else { + setValue(`fields.${index}.name`, label ? slugify(label) : ""); + } }, [label, setValue, index]); return (