Skip to content

Commit

Permalink
modify the condition to calculate amount again
Browse files Browse the repository at this point in the history
  • Loading branch information
cretadn22 committed May 1, 2024
1 parent a7db226 commit 2f0ba0e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/MoneyRequestConfirmationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,13 @@ function MoneyRequestConfirmationList({

const {unit, rate} = mileageRate ?? {};

const distance = TransactionUtils.getDistance(transaction);
const prevRate = usePrevious(rate);
const shouldCalculateDistanceAmount = isDistanceRequest && (iouAmount === 0 || prevRate !== rate);
const prevDistance = usePrevious(distance);
const shouldCalculateDistanceAmount = isDistanceRequest && (iouAmount === 0 || prevRate !== rate || prevDistance !== distance);

const currency = (mileageRate as MileageRate)?.currency ?? policyCurrency;

const distance = TransactionUtils.getDistance(transaction);
const taxRates = policy?.taxRates ?? null;

// A flag for showing the categories field
Expand Down

0 comments on commit 2f0ba0e

Please sign in to comment.