Skip to content

Fix footer Reset falling back to a stale selected-expense currency - #97767

Merged
mountiny merged 17 commits into
Expensify:mainfrom
c3024:chaitanya/97583-footer-reset-currency
Aug 10, 2026
Merged

Fix footer Reset falling back to a stale selected-expense currency#97767
mountiny merged 17 commits into
Expensify:mainfrom
c3024:chaitanya/97583-footer-reset-currency

Conversation

@c3024

@c3024 c3024 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

The footer's Reset/default currency fell back to the selected expense's own currency, so after changing Preferences > Payment currency, Reset kept restoring the old currency.

The Reset/default currency now comes from the active policy's output currency (the personal policy's for accounts without a workspace, which is what Preferences > Payment currency edits). This mirrors the currency the server converts search figures to when the query has no explicit target.

Reset also passes that currency through as an explicit selection instead of clearing the choice. The existing default chain compares it against the currency the loaded figures are denominated in, so the conversion machinery runs exactly when the figures are in another currency and stays idle otherwise.

Also changed SearchResultsProvider's defaultSearchInfo.currency from '' to undefined so an unset search currency is always undefined.

Fixed Issues

$ #97583
PROPOSAL:

Tests

  1. As a fresh account with no workspace, go to a self-DM and create an expense.
  2. Go to Spend > Expenses and select the expense via checkbox.
  3. Go to Account > Preferences > Payment currency and change it to a currency different from step 1's default (e.g. USD).
  4. Go back to Spend > Expenses and select the expense via checkbox.
  5. Click the currency selector on the footer, then click Reset.
  6. Verify the currency resets to the payment currency chosen in step 3 and the total amount is converted to it.
  7. Repeat steps 4-6 after switching to Reports and back to Expenses (the previously-working path) to confirm no regression.
Screen.Recording.2026-08-07.at.7.33.27.PM.mov
  • Verify that no errors appear in the JS console

Offline tests

Not affected — the payment currency is read from already-persisted Onyx data (PERSONAL_POLICY_ID and the personal policy), same as before; no new network requests are introduced.

QA Steps

  1. As a fresh account with no workspace, go to a self-DM and create an expense.
  2. Go to Spend > Expenses and select the expense via checkbox.
  3. Go to Account > Preferences > Payment currency and change it to a different currency.
  4. Go back to Spend > Expenses, select the expense, open the footer currency selector, and click Reset.
  5. Verify the currency resets to the payment currency chosen in step 3 and the total amount is converted to it.
  • 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 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 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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

effectiveDefaultCurrency fell back to metadataCurrency (the search
snapshot's currency) and then to the currency of whatever expense was
selected. For a fresh no-workspace account metadataCurrency is empty
until a search populates it, so Reset picked the selected expense's
currency instead of the user's live payment currency.

Fall back to usePreferredCurrency() instead, which reads the live
payment currency from Onyx.
@c3024
c3024 marked this pull request as ready for review August 5, 2026 14:03
@c3024
c3024 requested review from a team as code owners August 5, 2026 14:03
@melvin-bot
melvin-bot Bot requested review from ahmedGaber93 and garrettmknight and removed request for a team and garrettmknight August 5, 2026 14:03
@melvin-bot

melvin-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

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

@melvin-bot
melvin-bot Bot removed the request for review from a team August 5, 2026 14:03
@ahmedGaber93

ahmedGaber93 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible 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 checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • 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 verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • 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 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.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this 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.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Android: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-08-08.at.9.34.09.AM.mov

@ahmedGaber93

Copy link
Copy Markdown
Contributor

Bug: Changing the user's currency correctly updates the search total currency, but the total amount is not recalculated.

Screen.Recording.2026-08-06.at.6.50.27.PM.mov

c3024 added 5 commits August 6, 2026 22:05
…e loaded figures' denomination

The default footer currency now tracks the live payment currency, so it can move away from the currency the snapshot's server-converted figures are denominated in (e.g. after changing Preferences > Payment currency). Key the conversion machinery off the display target (picker choice or default) versus each row's denomination instead of only picker choices, and label unconverted figures with their own denomination.
… from the loaded figures' denomination"

This reverts commit ccf4730.
…plicit Reset

The default footer currency tracks the live payment currency, so it can move away from the currency the loaded figures are denominated in (e.g. after changing Preferences > Payment currency). Label unconverted totals with the figures' own denomination instead of the default's symbol, make Reset pass the default through as an explicit selection, and gate conversion on the chosen currency differing from the figures' denomination rather than from the default, so resetting to a just-changed payment currency converts the total to it.
Reset selects the current default explicitly, and the conversion gate compares the chosen currency against the loaded figures' denomination so that selection fires a conversion when the default moved after fetch. The unconverted-label changes are dropped.
The gate compared the chosen currency against only the first selected entry's denomination, so a mixed-denomination selection whose first row already matched the chosen currency never converted the remaining rows. Check all selected entries (and reports on the Reports search), skipping report-view rows like areAllSelectedEntriesConverted does.
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/components/Search/SearchPageFooter.tsx 2.56% <ø> (+0.06%) ⬆️
src/components/Search/SearchResultsProvider.tsx 76.92% <ø> (ø)
src/components/Search/SearchSelectionFooter.tsx 76.74% <100.00%> (+25.56%) ⬆️
... and 421 files with indirect coverage changes

c3024 added 5 commits August 7, 2026 18:42
…ffers from the figures

The picker's Reset/default currency now comes from the active policy's output currency (the personal policy's for accounts without a workspace, which is what Preferences > Payment currency edits), mirroring the currency the server converts search figures to when the query has no explicit target. Reset passes that currency through as an explicit selection instead of clearing the choice, and the existing default chain keeps comparing it against the figures' denomination, so the conversion machinery runs exactly when the loaded figures are in another currency.
getTargetCurrency falls back to the active policy's currency and then USD, so drop the personal-policy tier. Accounts without a workspace have their personal policy as the active policy, which the test setup now reflects.
c3024 added 2 commits August 7, 2026 19:27
Reset always passes a currency now, so the undefined variant is unreachable.
@c3024

c3024 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Fixed it.

Screen.Recording.2026-08-07.at.7.33.27.PM.mov

@c3024

c3024 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@ahmedGaber93 fixed that. Please re-review.

@ahmedGaber93 ahmedGaber93 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@melvin-bot
melvin-bot Bot requested a review from mountiny August 8, 2026 06:57

@mountiny mountiny left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the follow up, looks good to me

@trjExpensify

Copy link
Copy Markdown
Contributor

@mountiny can you merge this then?

@mountiny

Copy link
Copy Markdown
Contributor

Yes, slipped though with the new verify peer action you cant merge it immediately 🤦

@mountiny
mountiny merged commit f643069 into Expensify:main Aug 10, 2026
37 of 39 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

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

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.52-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 cancelled 🔪

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 No help site changes required.

This PR is an internal bug fix: it corrects the Reset action in the Spend page's selection-footer currency selector so it falls back to the account's payment currency (Preferences > Payment currency, i.e. the active policy's output currency) instead of a stale selected-expense currency. It restores intended behavior and adds a regression test — no user-facing feature, workflow, label, or setting name changes.

I searched App/docs/articles for anything documenting this behavior:

  • The interactive selection-footer currency selector and its Reset action are not documented in any help article.
  • The only currency-conversion topic in the Search/Spend docs is the group-currency: search operator, which is a separate query-syntax feature untouched by this PR.

Since no article describes the affected behavior, and the fix simply makes the UI behave as intended, there is nothing to update on the help site. No draft docs PR was created.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/roryabraham in version: 9.4.52-11 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

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.

6 participants