diff --git a/src/libs/TransactionUtils.ts b/src/libs/TransactionUtils.ts index 85571b0877ae..2a4815cc22a0 100644 --- a/src/libs/TransactionUtils.ts +++ b/src/libs/TransactionUtils.ts @@ -7,7 +7,6 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type {Beta, OnyxInputOrEntry, Policy, RecentWaypoint, ReviewDuplicates, TaxRate, TaxRates, Transaction, TransactionViolation, TransactionViolations} from '@src/types/onyx'; import type {Comment, Receipt, TransactionChanges, TransactionPendingFieldsKey, Waypoint, WaypointCollection} from '@src/types/onyx/Transaction'; -import type {Unit} from '@src/types/onyx/Policy'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import type {IOURequestType} from './actions/IOU'; import type {TransactionMergeParams} from './API/parameters'; diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index bc7de4c16a71..e0eba29e5f0c 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -2455,8 +2455,7 @@ function calculateAmountForUpdatedWaypointOrRate( policy: OnyxTypes.OnyxInputOrEntry, iouReport: OnyxTypes.OnyxInputOrEntry, ) { - const hasModifiedRate = !isEmptyObject(transactionChanges.customUnitRateID); - if (isEmptyObject(transactionChanges?.routes?.route0?.geometry) && !hasModifiedRate) { + if (isEmptyObject(transactionChanges?.routes?.route0?.geometry) && isEmptyObject(transactionChanges.customUnitRateID)) { return { amount: CONST.IOU.DEFAULT_AMOUNT, modifiedAmount: CONST.IOU.DEFAULT_AMOUNT, @@ -2464,7 +2463,7 @@ function calculateAmountForUpdatedWaypointOrRate( }; } - const customUnitRateID = hasModifiedRate ? transactionChanges.customUnitRateID! : TransactionUtils.getRateID(transaction) ?? ''; + const customUnitRateID = !isEmptyObject(transactionChanges.customUnitRateID) ? transactionChanges.customUnitRateID : TransactionUtils.getRateID(transaction) ?? ''; const mileageRates = DistanceRequestUtils.getMileageRates(policy, true); const policyCurrency = policy?.outputCurrency ?? PolicyUtils.getPersonalPolicy()?.outputCurrency ?? CONST.CURRENCY.USD;