From 3003ca5f488729f8fe167c80b852bcc7dab65fad Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Thu, 4 Apr 2024 16:26:42 +0700 Subject: [PATCH] Fix header displays skeleton when creating report with invalid user --- src/libs/actions/Report.ts | 15 ++++++++++----- src/pages/home/report/ReportActionItemCreated.tsx | 3 ++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index f5315f2c8006..cedbae4bf9da 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -739,11 +739,6 @@ function openReport( key: ONYXKEYS.PERSONAL_DETAILS_LIST, value: settledPersonalDetails, }); - failureData.push({ - onyxMethod: Onyx.METHOD.MERGE, - key: ONYXKEYS.PERSONAL_DETAILS_LIST, - value: settledPersonalDetails, - }); // Add the createdReportActionID parameter to the API call parameters.createdReportActionID = optimisticCreatedAction.reportActionID; @@ -1889,6 +1884,16 @@ function deleteReport(reportID: string) { Onyx.multiSet(onyxData); + // Clear the optimistic personal detail + const participantPersonalDetails: OnyxCollection = {}; + report?.participantAccountIDs?.forEach((accountID) => { + if (!allPersonalDetails?.[accountID]?.isOptimisticPersonalDetail) { + return; + } + participantPersonalDetails[accountID] = null; + }); + Onyx.merge(ONYXKEYS.PERSONAL_DETAILS_LIST, participantPersonalDetails); + // Delete linked IOU report if (report?.iouReportID) { deleteReport(report.iouReportID); diff --git a/src/pages/home/report/ReportActionItemCreated.tsx b/src/pages/home/report/ReportActionItemCreated.tsx index 4fe52f6adf41..5d634c95debd 100644 --- a/src/pages/home/report/ReportActionItemCreated.tsx +++ b/src/pages/home/report/ReportActionItemCreated.tsx @@ -119,6 +119,7 @@ export default withOnyx