File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
src/routes/settings/routes/profile/components Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -53,10 +53,10 @@ class ProfileSettingsForm extends Component {
5353 }
5454
5555 onBusinessPhoneCountryChange ( { country, externalChange } ) {
56- const { businessPhoneValid } = this . state
56+ const { businessPhoneValid, countrySelected : previousSelectedCountry } = this . state
5757
5858 if ( country && country . code ) {
59- if ( this . state . countrySelected !== country . name && country . name ) {
59+ if ( previousSelectedCountry !== country . name && country . name ) {
6060 // when country code of business phone changes, the country selection should change automatically
6161 this . refs . countrySelect . setValue ( country . name )
6262 this . setState ( {
@@ -78,7 +78,9 @@ class ProfileSettingsForm extends Component {
7878 // external change means, the user didn't change the phone number field.
7979 // But it was automatically changed due to country selection change. In such case, we should show
8080 // the alert under country selection only.
81- if ( ! externalChange ) {
81+ const countryName = country && country . name
82+ const countryCodeChanged = countryName && previousSelectedCountry && countryName !== previousSelectedCountry
83+ if ( ! externalChange && countryCodeChanged ) {
8284 this . setState ( {
8385 businessPhoneDirty : true
8486 } )
You can’t perform that action at this time.
0 commit comments