Skip to content

Commit

Permalink
Merge pull request #39585 from nkdengineer/fix/38879
Browse files Browse the repository at this point in the history
Fix header displays skeleton when creating report with invalid user
  • Loading branch information
deetergp authored Apr 9, 2024
2 parents cfa3b8f + 14303c0 commit 455dce4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
15 changes: 10 additions & 5 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -725,11 +725,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;
Expand Down Expand Up @@ -1943,6 +1938,16 @@ function deleteReport(reportID: string) {

Onyx.multiSet(onyxData);

// Clear the optimistic personal detail
const participantPersonalDetails: OnyxCollection<PersonalDetails> = {};
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);
Expand Down
3 changes: 2 additions & 1 deletion src/pages/home/report/ReportActionItemCreated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export default withOnyx<ReportActionItemCreatedProps, ReportActionItemCreatedOny
prevProps.report?.description === nextProps.report?.description &&
prevProps.personalDetails === nextProps.personalDetails &&
prevProps.policy?.description === nextProps.policy?.description &&
prevProps.report?.reportName === nextProps.report?.reportName,
prevProps.report?.reportName === nextProps.report?.reportName &&
prevProps.report?.errorFields === nextProps.report?.errorFields,
),
);

0 comments on commit 455dce4

Please sign in to comment.