Skip to content

Scheduling infrastructure for absolutely everyone.

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

Udit Takkara43fa13b1169
diff --git a/apps/web/components/eventtype/EventSetupTab.tsx b/apps/web/components/eventtype/EventSetupTab.tsx
index d5df1e89b7f..56fb4ab9349 100644
--- a/apps/web/components/eventtype/EventSetupTab.tsx
+++ b/apps/web/components/eventtype/EventSetupTab.tsx
@@ -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"
diff --git a/packages/ui/form/PhoneInput.tsx b/packages/ui/form/PhoneInput.tsx
index eaf36e30897..9d95c803a41 100644
--- a/packages/ui/form/PhoneInput.tsx
+++ b/packages/ui/form/PhoneInput.tsx
@@ -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={{