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

This commit is contained in:
Udit Takkar authored and GitHub committed 2024-02-26 22:18:58 +00:00
1 parent 2bf6da30b3
commit a43fa13b11
2 files changed
+5 -12

No files matched your search

+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={{