fix: hide duplicate phone field when attendee phone location selected (#23118)

* fix: hide duplicate phone field when attendee phone location selected

* Instead of hiding use autofill the value to all other phone fields

* add e2e test

* add not sync test and use changeHandler instead of useEffect

* address cubics comments

* adding the phone check back

* use zod schema instead of this type casting

* use Enum instead of hardcoded string for phone

* Fix e2e test

* Fix e2e tests

* Delete .retracify.html

---------

Co-authored-by: Eunjae Lee <[email protected]>
Co-authored-by: Volnei Munhoz <[email protected]>
Co-authored-by: Volnei Munhoz <[email protected]>
This commit is contained in:
authored and GitHub committed 2025-11-12 13:54:36 +00:00
1 parent 3e7a848769
commit a7cb71726a
4 files changed
+250 -8

No files matched your search

@@ -25,7 +25,6 @@ const renderLabel = (field: Partial<RhfFormField>) => {
if (field.labelAsSafeHtml) {
return (
<span
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{ __html: markdownToSafeHTML(field.labelAsSafeHtml) }}
/>
);
@@ -66,10 +65,12 @@ export const FormBuilderField = ({
field,
readOnly,
className,
onValueChange,
}: {
field: RhfFormFields[number];
readOnly: boolean;
className: string;
onValueChange?: (args: { name: string; value: unknown; prevValue: unknown }) => void;
}) => {
const { t } = useLocale();
const { control, formState } = useFormContext();
@@ -87,15 +88,18 @@ export const FormBuilderField = ({
// Make it a variable
name={`responses.${field.name}`}
render={({ field: { value, onChange }, fieldState: { error } }) => {
const setAndNotify = (val: unknown) => {
onChange(val);
onValueChange?.({ name: field.name, value: val, prevValue: value });
};
return (
<div>
<ComponentForField
field={{ ...field, label, placeholder, hidden }}
value={value}
readOnly={readOnly || shouldBeDisabled}
setValue={(val: unknown) => {
onChange(val);
}}
setValue={setAndNotify}
noLabel={noLabel}
translatedDefaultLabel={translatedDefaultLabel}
/>