Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amount changing to zero when editing it by going back in split bill workflow #29654

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -2862,7 +2862,7 @@ function setUpDistanceTransaction() {
*/
function navigateToNextPage(iou, iouType, report, path = '') {
const moneyRequestID = `${iouType}${report.reportID || ''}`;
const shouldReset = iou.id !== moneyRequestID;
const shouldReset = !_.isEmpty(report.reportID) && 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;
const shouldReset = !isDistanceRequest && props.iou.id !== moneyRequestId && !_.isEmpty(reportID.current);
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) {
if (prevMoneyRequestId.current !== iou.id && !_.isEmpty(reportID.current)) {
// 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 = iou.id !== moneyRequestId;
const shouldReset = !_.isEmpty(reportID.current) && iou.id !== moneyRequestId;
if (shouldReset) {
IOU.resetMoneyRequestInfo(moneyRequestId);
}
Expand Down
Loading