fix: If the input type "Name" is selected, the label can't be changed from our default label "Your Name" (#10618)

Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com>
1182-refactor-app-list-my-settings-conferencing-and-installed-app-conferencing^2
Zain Gulbaz 2023-08-11 11:33:38 +05:00 committed by GitHub
parent a4e7ca91b5
commit 5301af2e9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -530,6 +530,7 @@ function FieldLabel({ field }: { field: RhfFormField }) {
const fieldTypeConfigVariantsConfig = fieldTypeConfig?.variantsConfig;
const fieldTypeConfigVariants = fieldTypeConfigVariantsConfig?.variants;
const variantsConfig = field.variantsConfig;
const variantsConfigVariants = variantsConfig?.variants;
const defaultVariant = fieldTypeConfigVariantsConfig?.defaultVariant;
if (!fieldTypeConfigVariants || !variantsConfig) {
if (fieldsThatSupportLabelAsSafeHtml.includes(field.type)) {
@ -551,7 +552,9 @@ function FieldLabel({ field }: { field: RhfFormField }) {
"Field has `variantsConfig` but no `defaultVariant`" + JSON.stringify(fieldTypeConfigVariantsConfig)
);
}
return <span>{t(fieldTypeConfigVariants[variant as keyof typeof fieldTypeConfigVariants].label)}</span>;
const label =
variantsConfigVariants?.[variant as keyof typeof fieldTypeConfigVariants]?.fields?.[0]?.label || "";
return <span>{t(label)}</span>;
}
function VariantSelector() {