Skip to content

Commit

Permalink
Revert "Amount changing to zero when editing it by going back in spli…
Browse files Browse the repository at this point in the history
…t bill workflow"
  • Loading branch information
marcochavezf authored Oct 25, 2023
1 parent b4adb6b commit 5647304
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -2887,7 +2887,7 @@ function setUpDistanceTransaction() {
*/
function navigateToNextPage(iou, iouType, report, path = '') {
const moneyRequestID = `${iouType}${report.reportID || ''}`;
const shouldReset = !_.isEmpty(report.reportID) && iou.id !== moneyRequestID;
const shouldReset = iou.id !== moneyRequestID;

// 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 @@ -122,7 +122,7 @@ function MoneyRequestConfirmPage(props) {

// Reset the money request Onyx if the ID in Onyx does not match the ID from params
const moneyRequestId = `${iouType.current}${reportID.current}`;
const shouldReset = !isDistanceRequest && props.iou.id !== moneyRequestId && !_.isEmpty(reportID.current);
const shouldReset = !isDistanceRequest && props.iou.id !== moneyRequestId;
if (shouldReset) {
IOU.resetMoneyRequestInfo(moneyRequestId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function MoneyRequestParticipantsPage({iou, selectedTab, route}) {

useEffect(() => {
// ID in Onyx could change by initiating a new request in a separate browser tab or completing a request
if (prevMoneyRequestId.current !== iou.id && !_.isEmpty(reportID.current)) {
if (prevMoneyRequestId.current !== iou.id) {
// The ID is cleared on completing a request. In that case, we will do nothing
if (iou.id && !isDistanceRequest && !isSplitRequest) {
navigateBack(true);
Expand All @@ -90,7 +90,7 @@ function MoneyRequestParticipantsPage({iou, selectedTab, route}) {

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

0 comments on commit 5647304

Please sign in to comment.