Fix: Expense amount shown in brackets in LHN preview#86904
Fix: Expense amount shown in brackets in LHN preview#86904marufsharifi wants to merge 14 commits intoExpensify:mainfrom
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
Hey, I noticed you changed If you want to automatically generate translations for other locales, an Expensify employee will have to:
Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running: npx ts-node ./scripts/generateTranslations.ts --helpTypically, you'd want to translate only what you changed by running |
|
@aimane-chnaif 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: f4af4e2ac9
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| if (isExpenseReport(report) && typeof amount === 'number' && currency) { | ||
| const formattedAmount = convertToDisplayString(Math.abs(amount), currency); | ||
| return formatReportLastMessageText(`${formattedAmount} expense${comment ? ` for ${comment}` : ''}`); |
There was a problem hiding this comment.
Localize canonical expense preview text
This branch hardcodes the preview as ${formattedAmount} expense ... instead of using a translation key, so non-English users will see English text whenever getLastMessageTextForReport() hits this canonical fallback path (for example, when the visible action resolves to CREATED after rehydration). The existing preview path uses localized strings via getReportPreviewMessage, so this introduces a locale regression specifically in the new fallback behavior.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@aimane-chnaif I checked this flow in a non-English locale, and the LHN preview is already shown in English today (for example, BGN 24.65 expense for 34 miles in Japanese).
Should we preserve that current behavior here, or add a new translation key and localize this fallback ?
There was a problem hiding this comment.
We can support localization here
|
@aimane-chnaif, gentle bump. thanks. |
Code ReviewThe approach of building the preview from stable expense data instead of the raw message string is sound, but there are a few issues: 1. Hardcoded English strings (localization bug)
return formatReportLastMessageText(`${formattedAmount} expense${comment ? ` for ${comment}` : ''}`);This won't be translated for non-English users. The existing Note also that the existing 2. Consider reusing
|
|
Please address Melvin's review above |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
@aimane-chnaif All feedback has been addressed now. Could you please take another look when you get a chance? Thanks! |
|
@aimane-chnaif gentle bump. Thanks |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
@aimane-chnaif could you clarify which regression you mean here? The missing minus sign for negative expenses is a valid regression from this PR, and I’ll fix that. For the text difference, I believe the current behavior is intentional. Staging is showing the backend-provided preview text, while this PR switches the LHN fallback to the localized/client-formatted preview so the message is translated and includes the comment when available, as discussed here. |
|
Agree. Let's just fix minus case. Also test zero case |
|
@aimane-chnaif I’ve addressed the regressions. Could you please take another look when you have a moment? Thanks |
|
@aimane-chnaif kindly bump. Thanks |
|
@marufsharifi please merge main |
Code Review (Updated)The author has addressed all feedback from the previous review. The changes look good:
No further code concerns. LGTM pending the merge with main that |
|
I think we should get confirmation from product team.
staging:
|




Explanation of Change
This change fixes an inconsistency in the expense preview in the Left Hand Navigation.
Previously, the preview could change format for the same expense after opening or reselecting a report, making the UI feel unstable. Now, instead of relying on a raw message string that can be rehydrated differently, the app builds the preview from stable expense data like amount, currency, and comment. The result is a more consistent and predictable LHN preview for expense reports.
Fixed Issues
$ #83269
PROPOSAL: #83269 (comment)
Tests
Offline tests
Same as Tests.
QA Steps
Same as Tests.
// TODO: These must be filled out, or the issue title must include "[No QA]."
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
Screen.Recording.2026-04-01.at.11.04.37.PM.mov
Android: mWeb Chrome
Screen.Recording.2026-04-01.at.11.07.07.PM.mov
iOS: Native
Screen.Recording.2026-04-01.at.10.30.36.PM.1.mp4
iOS: mWeb Safari
Screen.Recording.2026-04-01.at.10.34.54.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2026-04-01.at.10.24.46.PM.mov