Skip to content

Commit

Permalink
Merge pull request #31579 from BhuvaneshPatil/fix-regression-amount-s…
Browse files Browse the repository at this point in the history
…etting-zero

Handle amount setting to zero when going back
  • Loading branch information
marcochavezf authored Dec 4, 2023
2 parents c861b36 + 3317ca5 commit 93121be
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -2918,7 +2918,7 @@ function setUpDistanceTransaction() {
*/
function navigateToNextPage(iou, iouType, report, path = '') {
const moneyRequestID = `${iouType}${report.reportID || ''}`;
const shouldReset = iou.id !== moneyRequestID;
const shouldReset = iou.id !== moneyRequestID && !_.isEmpty(report.reportID);

// If the money request ID in Onyx does not match the ID from params, we want to start a new request
// with the ID from params. We need to clear the participants in case the new request is initiated from FAB.
Expand Down
2 changes: 1 addition & 1 deletion src/pages/iou/steps/MoneyRequestConfirmPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function MoneyRequestConfirmPage(props) {

// Reset the money request Onyx if the ID in Onyx does not match the ID from params
const moneyRequestId = `${iouType}${reportID}`;
const shouldReset = !isDistanceRequest && props.iou.id !== moneyRequestId;
const shouldReset = !isDistanceRequest && props.iou.id !== moneyRequestId && !_.isEmpty(reportID);
if (shouldReset) {
IOU.resetMoneyRequestInfo(moneyRequestId);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import lodashGet from 'lodash/get';
import lodashSize from 'lodash/size';
import PropTypes from 'prop-types';
Expand Down Expand Up @@ -111,7 +112,7 @@ function MoneyRequestParticipantsPage({iou, selectedTab, route, transaction}) {

// Reset the money request Onyx if the ID in Onyx does not match the ID from params
const moneyRequestId = `${iouType}${reportID}`;
const shouldReset = iou.id !== moneyRequestId;
const shouldReset = iou.id !== moneyRequestId && !_.isEmpty(reportID);
if (shouldReset) {
IOU.resetMoneyRequestInfo(moneyRequestId);
}
Expand Down

0 comments on commit 93121be

Please sign in to comment.