Skip to content

Commit

Permalink
Merge pull request #52687 from mkzie2/mkzie2-issue/52135
Browse files Browse the repository at this point in the history
Update childStateNum and childStatusNum for parent report action
  • Loading branch information
marcaaron authored Nov 26, 2024
2 parents bcdaaf1 + e30f72e commit 2ce0764
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7203,6 +7203,30 @@ function unapproveExpenseReport(expenseReport: OnyxEntry<OnyxTypes.Report>) {
},
];

if (expenseReport.parentReportID && expenseReport.parentReportActionID) {
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${expenseReport.parentReportID}`,
value: {
[expenseReport.parentReportActionID]: {
childStateNum: CONST.REPORT.STATE_NUM.SUBMITTED,
childStatusNum: CONST.REPORT.STATUS_NUM.SUBMITTED,
},
},
});

failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${expenseReport.parentReportID}`,
value: {
[expenseReport.parentReportActionID]: {
childStateNum: expenseReport.stateNum,
childStatusNum: expenseReport.statusNum,
},
},
});
}

const parameters: UnapproveExpenseReportParams = {
reportID: expenseReport.reportID,
reportActionID: optimisticUnapprovedReportAction.reportActionID,
Expand Down Expand Up @@ -7413,6 +7437,30 @@ function cancelPayment(expenseReport: OnyxEntry<OnyxTypes.Report>, chatReport: O
},
];

if (expenseReport.parentReportID && expenseReport.parentReportActionID) {
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${expenseReport.parentReportID}`,
value: {
[expenseReport.parentReportActionID]: {
childStateNum: stateNum,
childStatusNum: statusNum,
},
},
});

failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${expenseReport.parentReportID}`,
value: {
[expenseReport.parentReportActionID]: {
childStateNum: expenseReport.stateNum,
childStatusNum: expenseReport.statusNum,
},
},
});
}

if (chatReport?.reportID) {
failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
Expand Down

0 comments on commit 2ce0764

Please sign in to comment.