Skip to content

Commit

Permalink
Merge pull request #50184 from nkdengineer/fix/50176
Browse files Browse the repository at this point in the history
[CP Staging] prevent removing waypoint if it is unnecessary

(cherry picked from commit 5906651)

(CP triggered by jasperhuangg)
  • Loading branch information
jasperhuangg authored and OSBotify committed Oct 3, 2024
1 parent e24436b commit f17ccd2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libs/actions/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ function saveWaypoint(transactionID: string, index: string, waypoint: RecentWayp
function removeWaypoint(transaction: OnyxEntry<Transaction>, currentIndex: string, isDraft?: boolean): Promise<void | void[]> {
// Index comes from the route params and is a string
const index = Number(currentIndex);
if (index === -1) {
return Promise.resolve();
}
const existingWaypoints = transaction?.comment?.waypoints ?? {};
const totalWaypoints = Object.keys(existingWaypoints).length;

Expand Down

0 comments on commit f17ccd2

Please sign in to comment.