Skip to content

Commit

Permalink
Merge pull request #53742 from mkzie2/mkzie2-issue/53481
Browse files Browse the repository at this point in the history
Fix new contact method isn't displayed
  • Loading branch information
mountiny authored Dec 9, 2024
2 parents 9d418f5 + 8bc8c53 commit 59193c6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/libs/actions/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ function addNewContactMethod(contactMethod: string, validateCode = '') {
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.PENDING_CONTACT_ACTION,
value: {
contactMethod: null,
validateCodeSent: null,
actionVerified: true,
errorFields: {
Expand Down
3 changes: 2 additions & 1 deletion src/pages/settings/Profile/Contacts/NewContactMethodPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import ROUTES from '@src/ROUTES';
import type SCREENS from '@src/SCREENS';
import INPUT_IDS from '@src/types/form/NewContactMethodForm';
import type {Errors} from '@src/types/onyx/OnyxCommon';
import {isEmptyObject} from '@src/types/utils/EmptyObject';

type NewContactMethodPageProps = PlatformStackScreenProps<SettingsNavigatorParamList, typeof SCREENS.SETTINGS.PROFILE.NEW_CONTACT_METHOD>;

Expand Down Expand Up @@ -162,7 +163,7 @@ function NewContactMethodPage({route}: NewContactMethodPageProps) {
User.clearContactMethodErrors(addSMSDomainIfPhoneNumber(pendingContactAction?.contactMethod ?? contactMethod), 'addedLogin');
}}
onClose={() => {
if (loginData?.errorFields && pendingContactAction?.contactMethod) {
if (!isEmptyObject(loginData?.errorFields) && pendingContactAction?.contactMethod) {
User.clearContactMethod(pendingContactAction?.contactMethod);
User.clearUnvalidatedNewContactMethodAction();
}
Expand Down

0 comments on commit 59193c6

Please sign in to comment.