Skip to content

Commit

Permalink
fix: compare only addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
sangar-1028 committed Oct 7, 2023
1 parent 8ae8745 commit 0da797f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/pages/EditRequestDistancePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,12 @@ function EditRequestDistancePage({report, route, transaction, transactionBackup}
* @param {Object} waypoints
*/
const saveTransaction = (waypoints) => {
// If nothing was changed, simply go back
const backupWaypoints = lodashGet(transactionBackup, 'comment.waypoints', {});
if (_.isEqual(backupWaypoints, waypoints)) {
// If nothing was changed, simply go to transaction thread
// We compare only addresses because numbers are rounded while backup
const oldWaypoints = lodashGet(transactionBackup, 'comment.waypoints', {});
const oldAddresses = _.mapObject(oldWaypoints, (waypoint) => _.pick(waypoint, 'address'));
const addresses = _.mapObject(waypoints, (waypoint) => _.pick(waypoint, 'address'));
if (_.isEqual(oldAddresses, addresses)) {
Navigation.dismissModal(report.reportID);
return;
}
Expand Down

0 comments on commit 0da797f

Please sign in to comment.