diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index d5676672dd33..4863c9a3561c 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -1,6 +1,7 @@ import Onyx from 'react-native-onyx'; import _ from 'underscore'; import lodashGet from 'lodash/get'; +import lodashHas from 'lodash/has'; import Str from 'expensify-common/lib/str'; import {format} from 'date-fns'; import CONST from '../../CONST'; @@ -1055,6 +1056,7 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco let oneOnOneChatReport; let isNewOneOnOneChatReport = false; let shouldCreateOptimisticPersonalDetails = false; + const personalDetailExists = lodashHas(allPersonalDetails, accountID); // If this is a split between two people only and the function // wasn't provided with an existing group chat report id @@ -1063,11 +1065,11 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco // entering code that creates optimistic personal details if ((!hasMultipleParticipants && !existingSplitChatReportID) || isOwnPolicyExpenseChat) { oneOnOneChatReport = splitChatReport; - shouldCreateOptimisticPersonalDetails = !existingSplitChatReport; + shouldCreateOptimisticPersonalDetails = !existingSplitChatReport && !personalDetailExists; } else { const existingChatReport = ReportUtils.getChatByParticipants([accountID]); isNewOneOnOneChatReport = !existingChatReport; - shouldCreateOptimisticPersonalDetails = isNewOneOnOneChatReport; + shouldCreateOptimisticPersonalDetails = isNewOneOnOneChatReport && !personalDetailExists; oneOnOneChatReport = existingChatReport || ReportUtils.buildOptimisticChatReport([accountID]); }