Skip to content
4 changes: 2 additions & 2 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8386,7 +8386,7 @@ function submitReport(expenseReport: OnyxTypes.Report) {
API.write(WRITE_COMMANDS.SUBMIT_REPORT, parameters, {optimisticData, successData, failureData});
}

function cancelPayment(expenseReport: OnyxEntry<OnyxTypes.Report>, chatReport: OnyxTypes.Report) {
function cancelPayment(expenseReport: OnyxEntry<OnyxTypes.Report>, chatReport: OnyxTypes.Report, backTo?: Route) {
if (isEmptyObject(expenseReport)) {
return;
}
Expand Down Expand Up @@ -8529,7 +8529,7 @@ function cancelPayment(expenseReport: OnyxEntry<OnyxTypes.Report>, chatReport: O
},
{optimisticData, successData, failureData},
);
Navigation.dismissModal();
Navigation.goBack(backTo);
notifyNewAction(expenseReport.reportID, userAccountID);
}

Expand Down
4 changes: 2 additions & 2 deletions src/pages/ReportDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,9 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
return;
}

cancelPaymentAction(moneyRequestReport, chatReport);
cancelPaymentAction(moneyRequestReport, chatReport, backTo);
setIsConfirmModalVisible(false);
}, [moneyRequestReport, chatReport]);
}, [moneyRequestReport, chatReport, backTo]);

const menuItems: ReportDetailsPageMenuItem[] = useMemo(() => {
const items: ReportDetailsPageMenuItem[] = [];
Expand Down