Skip to content

Commit f60f8ee

Browse files
authored
Merge pull request #60694 from nkdengineer/fix/60680
fix: amount is not updating optimistically in the Expense Report
2 parents 0e28efd + e84492a commit f60f8ee

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/components/TransactionItemRow/DataCells/TotalCell.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@ import TextWithTooltip from '@components/TextWithTooltip';
33
import useLocalize from '@hooks/useLocalize';
44
import useThemeStyles from '@hooks/useThemeStyles';
55
import {convertToDisplayString} from '@libs/CurrencyUtils';
6+
import {getTransactionDetails} from '@libs/ReportUtils';
67
import {getCurrency as getTransactionCurrency, hasReceipt, isReceiptBeingScanned} from '@libs/TransactionUtils';
78
import type TransactionDataCellProps from './TransactionDataCellProps';
89

910
function TotalCell({shouldShowTooltip, transactionItem}: TransactionDataCellProps) {
1011
const styles = useThemeStyles();
1112
const {translate} = useLocalize();
1213
const currency = getTransactionCurrency(transactionItem);
13-
14-
let amount = convertToDisplayString(Math.abs(transactionItem.amount), currency);
15-
14+
const amount = getTransactionDetails(transactionItem)?.amount;
15+
let amountToDisplay = convertToDisplayString(amount, currency);
1616
if (hasReceipt(transactionItem) && isReceiptBeingScanned(transactionItem)) {
17-
amount = translate('iou.receiptStatusTitle');
17+
amountToDisplay = translate('iou.receiptStatusTitle');
1818
}
1919

2020
return (
2121
<TextWithTooltip
2222
shouldShowTooltip={shouldShowTooltip}
23-
text={amount}
23+
text={amountToDisplay}
2424
style={[styles.optionDisplayName, styles.justifyContentCenter]}
2525
/>
2626
);

0 commit comments

Comments
 (0)