Skip to content

fix: amount is not updating optimistically in the Expense Report #60694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/components/TransactionItemRow/DataCells/TotalCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ import TextWithTooltip from '@components/TextWithTooltip';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import {convertToDisplayString} from '@libs/CurrencyUtils';
import {getTransactionDetails} from '@libs/ReportUtils';
import {getCurrency as getTransactionCurrency, hasReceipt, isReceiptBeingScanned} from '@libs/TransactionUtils';
import type TransactionDataCellProps from './TransactionDataCellProps';

function TotalCell({shouldShowTooltip, transactionItem}: TransactionDataCellProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
const currency = getTransactionCurrency(transactionItem);

let amount = convertToDisplayString(Math.abs(transactionItem.amount), currency);

const amount = getTransactionDetails(transactionItem)?.amount;
let amountToDisplay = convertToDisplayString(amount, currency);
if (hasReceipt(transactionItem) && isReceiptBeingScanned(transactionItem)) {
amount = translate('iou.receiptStatusTitle');
amountToDisplay = translate('iou.receiptStatusTitle');
}

return (
<TextWithTooltip
shouldShowTooltip={shouldShowTooltip}
text={amount}
text={amountToDisplay}
style={[styles.optionDisplayName, styles.justifyContentCenter]}
/>
);
Expand Down