Fix phone deletion (#12821)

Fixes https://github.com/twentyhq/core-team-issues/issues/1124
This commit is contained in:
Marie
2025-06-24 15:12:40 +02:00
committed by GitHub
parent 2da66af26a
commit 540f3ffd67
2 changed files with 25 additions and 8 deletions

View File

@ -1,8 +1,3 @@
import {
isDefined,
parseJson,
removeUndefinedFields,
} from 'twenty-shared/utils';
import { isNonEmptyString } from '@sniptt/guards';
import {
CountryCallingCode,
@ -11,6 +6,11 @@ import {
getCountryCallingCode,
parsePhoneNumberWithError,
} from 'libphonenumber-js';
import {
isDefined,
parseJson,
removeUndefinedFields,
} from 'twenty-shared/utils';
import {
RecordTransformerException,
@ -165,7 +165,7 @@ const validateAndInferPhoneInput = ({
countryCode,
});
if (isDefined(number)) {
if (isDefined(number) && isNonEmptyString(number)) {
return validateAndInferMetadataFromPrimaryPhoneNumber({
number,
callingCode,