Skip to content

Commit

Permalink
Merge pull request #30754 from paultsimura/fix/30176-add-empty-stop
Browse files Browse the repository at this point in the history
fix: Distance: prevent unnecessary operations when adding an empty stop
  • Loading branch information
NikkiWines authored Nov 2, 2023
2 parents fcb1fa5 + 2f4b98a commit 45c1297
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/libs/actions/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ function removeWaypoint(transactionID: string, currentIndex: string) {

const waypointValues = Object.values(existingWaypoints);
const removed = waypointValues.splice(index, 1);
if (removed.length === 0) {
return;
}

const isRemovedWaypointEmpty = removed.length > 0 && !TransactionUtils.waypointHasValidAddress(removed[0] ?? {});

// When there are only two waypoints we are adding empty waypoint back
Expand Down

0 comments on commit 45c1297

Please sign in to comment.