[CP Staging] Fix the Search footer showing $0.00#85566
[CP Staging] Fix the Search footer showing $0.00#85566mountiny merged 1 commit intoExpensify:mainfrom
Conversation
|
@ShridharGoel Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5d8addf79c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| }, 0) | ||
| : metadata?.count; | ||
| const total = shouldUseClientTotal ? selectedTransactionItems.reduce((acc, transaction) => acc - (transaction.groupAmount ?? 0), 0) : metadata?.total; | ||
| const total = shouldUseClientTotal ? selectedTransactionItems.reduce((acc, transaction) => acc - (transaction.groupAmount ?? -Math.abs(transaction.amount)), 0) : metadata?.total; |
There was a problem hiding this comment.
Avoid summing mixed-currency amounts without conversion
When groupAmount is missing, this fallback adds Math.abs(transaction.amount) values directly, but amount is stored in each transaction’s original currency. In the default Expenses view (shouldCalculateTotals=false), selecting transactions with different currencies will now produce a mathematically invalid total and label it with a single currency (from metadata/first item), which misstates spend. The total should only be computed from a common-currency field (e.g., groupAmount) or guarded to same-currency selections.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
That's a valid observation, but it's not a new problem introduced by this fix - the existing code already sums groupAmount values and labels the total with a single currency. When groupAmount is available, it's converted to the group/policy currency, so mixed currencies work. When it's missing (the bug case), the previous behavior was showing $0.00, which is strictly worse. This fix at least shows a correct total for the common single-currency case. A multi-currency guard could be a follow-up improvement but is outside the scope of this regression fix.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-03-17.at.10.53.00.PM.mov |
…-footer-0-00 [CP Staging] Fix the Search footer showing $0.00 (cherry picked from commit f74fdc0) (cherry-picked to staging by mountiny)
|
🚧 @mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
|
🚀 Cherry-picked to staging by https://github.com/mountiny in version: 9.3.39-3 🚀
|
|
@JakubKorytko CP was passed by QA team, comment cc @mountiny |
|
🚀 Cherry-picked to staging by https://github.com/mountiny in version: 9.3.39-3 🚀
|
|
Retrying failed builds |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.3.39-3 🚀
|
|
🚀 Cherry-picked to staging by https://github.com/mountiny in version: 9.3.40-0 🚀
|
|
🚀 Cherry-picked to staging by https://github.com/mountiny in version: 9.3.39-3 🚀
|
1 similar comment
|
🚀 Cherry-picked to staging by https://github.com/mountiny in version: 9.3.39-3 🚀
|
|
🚀 Cherry-picked to staging by https://github.com/mountiny in version: 9.3.40-0 🚀
|
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.3.41-4 🚀
|
Explanation of Change
This PR fixes the Search footer showing $0.00 when selecting expenses on the default "Expenses" search view. The footer total relied solely on
groupAmount, which is only populated whenshouldCalculateTotals=true. For the default Expenses search key this flag is false, sogroupAmountis alwaysundefinedand the total falls back to 0. This adds a fallback toMath.abs(transaction.amount)and a defensive currency fallback totransaction.currency.Fixed Issues
$ #85534
PROPOSAL: N/A
Tests
Offline tests
N/A
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
web.mp4