Skip to content

[CP Staging] Revert "Refactor: migrate convertToDisplayString to useCurrencyListActions hook (part 16)" - #98357

Open
mountiny wants to merge 2 commits into
mainfrom
revert-97892-convertToDisplayString-16
Open

[CP Staging] Revert "Refactor: migrate convertToDisplayString to useCurrencyListActions hook (part 16)"#98357
mountiny wants to merge 2 commits into
mainfrom
revert-97892-convertToDisplayString-16

Conversation

@mountiny

@mountiny mountiny commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

Reverts Refactor: migrate convertToDisplayString to useCurrencyListActions hook (part 16) (merge commit 9ba579bbbd303c74f9a7ffef1ae5c88d476c820c) as a candidate fix for the deploy blocker.

The revert restores convertToDisplayString in getReportPreviewReportActionMessage and getIOUReportActionMessage, and removes the getCurrencyDecimals threading that PR 97892 added.

git revert -m 1 conflicted in 16 files because later PRs moved this code. The conflicts were resolved as follows:

  1. Kept getCurrencyDecimals wherever code merged after 97892 still needs it — duplicateReport / bulkDuplicateReports (they pass it into RequestMoneyInformation), AddExistingExpenseFooter (it passes it into convertBulkTrackedExpensesToIOU), and useExpenseActions.
  2. Removed the getCurrencyDecimals parameter from buildOptimisticApprovedReportAction, buildOptimisticUnapprovedReportAction, buildOptimisticSubmittedReportAction, unapproveExpenseReport, and the submitReport / buildOptimisticIOUReportAction destructures, because the revert leaves it unused there. The matching call sites in ReportWorkflow.ts, useLifecycleActions.tsx, and the tests were updated.
  3. BuildOptimisticIOUReportActionParams.getCurrencyDecimals and SubmitReportFunctionParams.getCurrencyDecimals were left on the types so the 61 call sites stay untouched.

Verification: tsc --noEmit is clean (the single remaining error in tests/unit/hooks/useDiscardChangesConfirmationNative.test.ts is pre-existing on main), ESLint is clean on every changed file, and the 9 affected Jest suites pass (2340 tests).

Fixed Issues

$ #98327

Tests

  1. Open the app and go to an expense report.
  2. Right click the report preview, open Debug, and verify the amount in the preview message renders in English format.
  3. Add an expense to the report and repeat step 2.
  4. Create a new report and repeat step 2.
  5. Approve an expense report and verify the approved message shows the correct amount.
  6. Unapprove that report and verify the unapproved message shows the correct amount.
  7. Submit an expense report and verify the submitted message shows the correct amount.
  8. Go to Home, scroll to the Spend over time chart, and verify it loads instead of spinning forever.
  • Verify that no errors appear in the JS console

Offline tests

  1. Turn off your network connection.
  2. Add an expense to a report and verify the preview message shows the correct amount.
  3. Approve and unapprove a report and verify both messages show the correct amount.
  4. Go back online and verify the messages still show the correct amounts after the server responds.
  • Verify that no errors appear in the JS console

QA Steps

  1. Sign in to an account with many expenses.
  2. Go to Home and scroll down to the Spend over time chart.
  3. Verify the chart loads and does not spin indefinitely.
  4. Open an expense report and verify the report preview message shows the correct amount.
  5. Add an expense to the report and verify the preview message updates with the correct amount.
  6. Approve the report and verify the approved message shows the correct amount.
  7. Unapprove the report and verify the unapproved message shows the correct amount.
  8. Submit a new report and verify the submitted message shows the correct amount.
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native

Not yet tested — needs manual QA.

Android: mWeb Chrome

Not yet tested — needs manual QA.

iOS: Native

Not yet tested — needs manual QA.

iOS: mWeb Safari

Not yet tested — needs manual QA.

MacOS: Chrome / Safari

Not yet tested — needs manual QA.

…rtToDisplayString-16"

This reverts commit 9ba579b, reversing
changes made to 425061a.
@mountiny mountiny changed the title Revert "Refactor: migrate convertToDisplayString to useCurrencyListActions hook (part 16)" [CP Staging] Revert "Refactor: migrate convertToDisplayString to useCurrencyListActions hook (part 16)" Aug 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here.

@mountiny

Copy link
Copy Markdown
Contributor Author

Asked here for QA to retest the linked blocker on this revert pr https://expensify.slack.com/archives/C09V78U42D8/p1786478282519219

@mountiny
mountiny marked this pull request as ready for review August 11, 2026 19:58
@mountiny
mountiny requested review from a team as code owners August 11, 2026 19:58
@melvin-bot
melvin-bot Bot requested review from ZhenjaHorbach and trjExpensify and removed request for a team August 11, 2026 19:58
@melvin-bot

melvin-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

@ZhenjaHorbach 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]

@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/components/AddExistingExpenseFooter.tsx 0.00% <ø> (ø)
src/components/KYCWall/BaseKYCWall.tsx 48.90% <ø> (-0.28%) ⬇️
...nents/Navigation/QuickCreationActionsBar/index.tsx 86.04% <ø> (-0.17%) ⬇️
.../SearchPageHeader/SearchActionsBarCreateButton.tsx 96.10% <ø> (-0.05%) ⬇️
src/hooks/useCreateNewReport.tsx 100.00% <100.00%> (ø)
src/hooks/useUndeleteTransactions.ts 81.25% <ø> (-1.11%) ⬇️
src/libs/actions/IOU/Duplicate.ts 91.94% <100.00%> (ø)
src/libs/actions/IOU/ReportWorkflow.ts 81.75% <100.00%> (-0.14%) ⬇️
src/libs/actions/Policy/Policy.ts 70.51% <ø> (ø)
src/libs/actions/Report/index.ts 71.61% <100.00%> (-0.10%) ⬇️
... and 12 more
... and 4 files with indirect coverage changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 51af935c88

ℹ️ 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".

Comment thread src/libs/ReportUtils.ts
Comment on lines 7422 to +7425
const amount =
type === CONST.IOU.REPORT_ACTION_TYPE.PAY && !isEmptyObject(report)
? convertToDisplayStringEnLocale(getMoneyRequestSpendBreakdown(report).totalDisplaySpend, currency, getCurrencyDecimals)
: convertToDisplayStringEnLocale(total, currency, getCurrencyDecimals);
? convertToDisplayStringUtil(getMoneyRequestSpendBreakdown(report).totalDisplaySpend, currency)
: convertToDisplayStringUtil(total, currency);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep stored action amounts in English locale

When the app locale is non-English, convertToDisplayStringUtil formats with IntlStore.getCurrentLocale() in CurrencyUtils, but these strings are persisted as report action text alongside hard-coded English phrases like approved, submitted, and paid. This means an offline/optimistic approve, submit, pay, or request action can store mixed-language formatting such as Spanish currency separators inside English action text until the server response replaces it. Please keep this path on the English-locale formatter while avoiding the hook dependency.

Useful? React with 👍 / 👎.

@trjExpensify

Copy link
Copy Markdown
Contributor

PR doesn’t need product input as a revert PR. Unassigning and unsubscribing myself.

@trjExpensify
trjExpensify removed their request for review August 11, 2026 22:37
@mountiny

Copy link
Copy Markdown
Contributor Author

@MelvinBot can you sync with latest main

…oDisplayString-16

Co-authored-by: Vit Horacek <mountiny@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 Synced with latest main — merged origin/main (4c50054) into revert-97892-convertToDisplayString-16 and pushed merge commit 6d77ceab80f. No conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants