fix: Form Builder Name Field Shows Default Label When Custom Label is Empty (#24201)
* removed previious pr ommit from thi sone * fixed addressed issues * fallback to non-empty label for variant fields * fallback to default label * normalize empty labels and fallback to default when label equals field name * fix: initially use empty label for name field (fullName variant) Co-authored-by: Cursor <[email protected]> * fix: remove normalization of empty field labels in FormBuilder * fix: enhance label handling in getTranslatedConfigVariants function * Update apps/web/modules/event-types/components/tabs/advanced/FormBuilder.tsx Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Pallav <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Sahitya Chandra <[email protected]> Co-authored-by: Cursor <[email protected]>
This commit is contained in:
3 files changed
+29
-8
No files matched your search
@@ -909,9 +909,15 @@ function FieldLabel({ field }: { field: RhfFormField }) {
|
||||
`Field has \`variantsConfig\` but no \`defaultVariant\`${JSON.stringify(fieldTypeConfigVariantsConfig)}`
|
||||
);
|
||||
}
|
||||
const label =
|
||||
variantsConfigVariants?.[variant as keyof typeof fieldTypeConfigVariants]?.fields?.[0]?.label || "";
|
||||
return <span>{t(label)}</span>;
|
||||
const variantData = variantsConfigVariants?.[variant as keyof typeof fieldTypeConfigVariants];
|
||||
const firstField = variantData?.fields?.[0];
|
||||
const label = firstField?.label?.trim() ? firstField.label : "";
|
||||
const firstFieldName = firstField?.name;
|
||||
const defaultLabelFromTypeConfig =
|
||||
fieldTypeConfigVariants?.[variant as keyof typeof fieldTypeConfigVariants]?.fieldsMap?.[
|
||||
firstFieldName as keyof (typeof fieldTypeConfigVariants)[typeof variant]["fieldsMap"]
|
||||
]?.defaultLabel || "";
|
||||
return <span>{t(label || defaultLabelFromTypeConfig)}</span>;
|
||||
}
|
||||
|
||||
function VariantSelector() {
|
||||
@@ -1050,4 +1056,4 @@ function VariantFields({
|
||||
</ul>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user