Problem
getBillableAndTaxTotal only needs four fields from each transaction (amount, taxAmount, currency, billable) but was calling getTransactionDetails, which materializes the full TransactionDetails object per transaction — including two timezone-aware date formats, attendees, waypoints, MCC group, and more, all immediately discarded. On an expense report with N transactions this was ~2N date-fns timezone format calls thrown away. Flame graph on iOS showed ~1.2s spent in this function on report-open, dominated by getFormattedCreated → formatWithUTCTimeZone.
Solution
Replace getTransactionDetails with direct accessors (getBillable, getTaxAmount, getCurrency, getTransactionAmount), hoist reportCurrency out of the loop, pass isFromExpenseReport = true directly to skip per-transaction report lookups, and short-circuit when both billable and taxAmount are falsy. On a report with 1.6k transactions, getBillableAndTaxTotal time dropped from ~1.2s to ~5ms.
PR
#91716
Issue Owner
Current Issue Owner: @Pujan92
Problem
getBillableAndTaxTotalonly needs four fields from each transaction (amount,taxAmount,currency,billable) but was callinggetTransactionDetails, which materializes the fullTransactionDetailsobject per transaction — including two timezone-aware date formats, attendees, waypoints, MCC group, and more, all immediately discarded. On an expense report with N transactions this was ~2N date-fns timezone format calls thrown away. Flame graph on iOS showed ~1.2s spent in this function on report-open, dominated bygetFormattedCreated→formatWithUTCTimeZone.Solution
Replace
getTransactionDetailswith direct accessors (getBillable,getTaxAmount,getCurrency,getTransactionAmount), hoistreportCurrencyout of the loop, passisFromExpenseReport = truedirectly to skip per-transaction report lookups, and short-circuit when bothbillableandtaxAmountare falsy. On a report with 1.6k transactions,getBillableAndTaxTotaltime dropped from ~1.2s to ~5ms.PR
#91716
Issue Owner
Current Issue Owner: @Pujan92