fix: resolve ui unique labels

This commit is contained in:
yassinedorbozgithub 2025-06-10 18:25:41 +01:00
parent bac3597614
commit 5b08d9d36f

View File

@ -53,11 +53,11 @@ export const ContentTypeForm: FC<ComponentFormProps<IContentType>> = ({
name: "fields", name: "fields",
rules: { rules: {
validate: (fields) => { validate: (fields) => {
const hasDuplicatedLabels = const hasUniqueLabels =
new Set(fields.map((f) => f["label"] as string)).size === new Set(fields.map((f) => f["label"] as string)).size ===
fields.length; fields.length;
if (hasDuplicatedLabels) { if (!hasUniqueLabels) {
toast.error(t("message.duplicate_labels_not_allowed")); toast.error(t("message.duplicate_labels_not_allowed"));
return false; return false;