From a11c0ea38b0de974d65c294bf120360e88495af5 Mon Sep 17 00:00:00 2001 From: Andrew Rosiclair Date: Wed, 14 Feb 2024 13:49:46 -0500 Subject: [PATCH] ensure isOptimisticReport is set --- src/libs/ReportUtils.ts | 5 ++++- src/libs/actions/IOU.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 8dda1a176237..711af58280c8 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -232,7 +232,9 @@ type OptimisticChatReport = Pick< | 'visibility' | 'description' | 'writeCapability' ->; +> & { + isOptimisticReport: true; +}; type OptimisticTaskReportAction = Pick< ReportAction, @@ -3324,6 +3326,7 @@ function buildOptimisticChatReport( const currentTime = DateUtils.getDBTime(); const isNewlyCreatedWorkspaceChat = chatType === CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT && isOwnPolicyExpenseChat; return { + isOptimisticReport: true, type: CONST.REPORT.TYPE.CHAT, chatType, isOwnPolicyExpenseChat, diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 7fca6614f1a1..1b9190ed1674 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -1676,7 +1676,7 @@ function createSplitsAndOnyxData( // STEP 1: Get existing chat report OR build a new optimistic one // If we only have one participant and the request was initiated from the global create menu, i.e. !existingGroupChatReportID, the oneOnOneChatReport is the groupChatReport - let oneOnOneChatReport: OptimisticChatReport; + let oneOnOneChatReport: OnyxTypes.Report | OptimisticChatReport; let isNewOneOnOneChatReport = false; let shouldCreateOptimisticPersonalDetails = false; const personalDetailExists = accountID in allPersonalDetails;