fix: infinite rendering in event setup tab (#13877)

This commit is contained in:
Udit Takkar
2024-02-26 22:18:58 +00:00
committed by GitHub
parent 2bf6da30b3
commit a43fa13b11
2 changed files with 5 additions and 12 deletions
@@ -318,7 +318,7 @@ export const EventSetupTab = (
/>
</div>
<ErrorMessage
errors={formMethods.formState.errors.locations?.[index]}
errors={formMethods.formState.errors?.locations?.[index]}
name={eventLocationType.defaultValueVariable}
className="text-error my-1 ml-6 text-sm"
as="div"
+4 -11
View File
@@ -17,21 +17,14 @@ export type PhoneInputProps = {
onChange: (value: string) => void;
};
function BasePhoneInput({ name, className = "", onChange, ...rest }: PhoneInputProps) {
useEffect(() => {
if (!rest.value) {
return;
}
const formattedValue = rest.value.trim().replace(/^\+?/, "+");
onChange(formattedValue);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
function BasePhoneInput({ name, className = "", onChange, value, ...rest }: PhoneInputProps) {
const defaultCountry = useDefaultCountry();
return (
<PhoneInput
{...rest}
country={rest.value ? undefined : defaultCountry}
value={value ? value.trim().replace(/^\+?/, "+") : undefined}
country={value ? undefined : defaultCountry}
enableSearch
disableSearchIcon
inputProps={{