From 2f0ba0ed67c0018b0db83edd3bca1752d3b66dc0 Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Thu, 2 May 2024 00:02:39 +0700 Subject: [PATCH] modify the condition to calculate amount again --- src/components/MoneyRequestConfirmationList.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/MoneyRequestConfirmationList.tsx b/src/components/MoneyRequestConfirmationList.tsx index 17ee0d31d63c..1916d3c2892b 100755 --- a/src/components/MoneyRequestConfirmationList.tsx +++ b/src/components/MoneyRequestConfirmationList.tsx @@ -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