diff --git a/src/libs/PersonalDetailsUtils.js b/src/libs/PersonalDetailsUtils.js index 4d2cf389dae3..1d4966826492 100644 --- a/src/libs/PersonalDetailsUtils.js +++ b/src/libs/PersonalDetailsUtils.js @@ -123,7 +123,6 @@ function getNewPersonalDetailsOnyxData(logins, accountIDs) { * This is done to prevent duplicate entries (upon success) since the BE will return other personal details with the correct account IDs. */ successData[accountID] = null; - failureData[accountID] = null; } }); diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js index 4a58f52eff0a..6c780dfe6dc4 100644 --- a/src/libs/actions/Policy.js +++ b/src/libs/actions/Policy.js @@ -7,14 +7,12 @@ import {escapeRegExp} from 'lodash'; import * as API from '../API'; import ONYXKEYS from '../../ONYXKEYS'; import CONST from '../../CONST'; -import * as LocalePhoneNumber from '../LocalePhoneNumber'; import * as OptionsListUtils from '../OptionsListUtils'; import * as ErrorUtils from '../ErrorUtils'; import * as ReportUtils from '../ReportUtils'; import * as PersonalDetailsUtils from '../PersonalDetailsUtils'; import Log from '../Log'; import Permissions from '../Permissions'; -import * as UserUtils from '../UserUtils'; const allPolicies = {}; Onyx.connect({ @@ -360,24 +358,6 @@ function addMembersToWorkspace(invitedEmailsToAccountIDs, welcomeNote, policyID, // create onyx data for policy expense chats for each new member const membersChats = createPolicyExpenseChats(policyID, invitedEmailsToAccountIDs, betas); - // Optimistic personal details for the new accounts invited - const optimisticPersonalDetails = _.chain(invitedEmailsToAccountIDs) - .map( - (accountID, memberLogin) => - !_.has(allPersonalDetails, accountID) && [ - accountID, - { - accountID, - avatar: UserUtils.getDefaultAvatarURL(accountID), - displayName: LocalePhoneNumber.formatPhoneNumber(memberLogin), - login: OptionsListUtils.addSMSDomainIfPhoneNumber(memberLogin), - }, - ], - ) - .compact() - .object() - .value(); - const optimisticData = [ { onyxMethod: Onyx.METHOD.MERGE, @@ -388,11 +368,6 @@ function addMembersToWorkspace(invitedEmailsToAccountIDs, welcomeNote, policyID, }, ...newPersonalDetailsOnyxData.optimisticData, ...membersChats.onyxOptimisticData, - { - onyxMethod: Onyx.METHOD.MERGE, - key: ONYXKEYS.PERSONAL_DETAILS_LIST, - value: optimisticPersonalDetails, - }, ]; const successData = [ @@ -406,11 +381,6 @@ function addMembersToWorkspace(invitedEmailsToAccountIDs, welcomeNote, policyID, }, ...newPersonalDetailsOnyxData.successData, ...membersChats.onyxSuccessData, - { - onyxMethod: Onyx.METHOD.MERGE, - key: ONYXKEYS.PERSONAL_DETAILS_LIST, - value: _.object(_.keys(optimisticPersonalDetails), Array(_.size(optimisticPersonalDetails)).fill(null)), - }, ]; const failureData = [