App icon indicating copy to clipboard operation
App copied to clipboard

[Due for payment 2026-12-08] [$175] Expense - Currency remains in default workspace currency after selecting user on confirm page

Open applause-bot[bot] opened this issue 2 weeks ago • 45 comments

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.5-37-0 Reproducible in staging?: Yes Reproducible in production?: No If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://github.com/Expensify/App/pull/104024 Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mac 26.5 / Chrome App Component: Money Requests

Action Performed:

Precondition:

  • Default workspace currency is different from payment curency.
  1. Go to staging.new.expensify.com
  2. Open FAB > Create expense > Manual.
  3. Click To field.
  4. Enter email and select user.

Expected Result:

Currency will default to payment currency after selecting user on confirm page.

Actual Result:

Currency remains in default workspace currency after selecting user on confirm page.

Workaround:

Unknown

Platforms:

  • [ ] Android: App
  • [ ] Android: mWeb Chrome
  • [ ] iOS: App
  • [ ] iOS: mWeb Safari
  • [ ] iOS: mWeb Chrome
  • [x] Windows: Chrome
  • [x] MacOS: Chrome Safari

Screenshots/Videos

https://github.com/user-attachments/assets/ad8937f4-4a42-4334-babf-cf3d5e7153ce

View all open jobs on GitHub

Applause Internal Information Exported by: Julia Ponikarchuk Bug ID: 7312143

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @FitseTLT

applause-bot[bot] avatar Nov 12 '26 10:11 applause-bot[bot]

While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/71ec6bf37b39faacb2d5003e9f5e2150946782ad3d59f018989d2d399682ca95

applause-bot[bot] avatar Nov 12 '26 10:11 applause-bot[bot]

You have been assigned to this deploy blocker because you recently merged this PR: https://github.com/Expensify/App/pull/104024

melvin-bot[bot] avatar Nov 12 '26 10:11 melvin-bot[bot]

@jasperhuangg @FitseTLT you have been assigned to this deploy blocker because you reviewed the offending PR: https://github.com/Expensify/App/pull/104024

melvin-bot[bot] avatar Nov 12 '26 10:11 melvin-bot[bot]

💬 A slack conversation has been started in #expensify-open-source

melvin-bot[bot] avatar Nov 12 '26 10:11 melvin-bot[bot]

:wave: Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

github-actions[bot] avatar Nov 12 '26 10:11 github-actions[bot]

Proposal

What is the root cause of that problem?

Default global-create expense currency to the default workspace currency introduces the regression: the draft now starts with workspace currency, but selecting an individual updates the recipient without restoring Payment currency.

Confidence: high from code/history evidence. No fresh browser reproduction or tests were run.

Supporting evidence

This is retained initialization state, not a later effect repeatedly overwriting currency. The missing transition handling predates the PR; changing the initial default exposed it.

What changes do you think we should make in order to solve the problem?

Recommended deploy-safe resolution: revert the introducing PR and retain the blocker until verified. This restores the previous behavior but reopens the original workspace-default currency issue.

For a follow-up fix, update recipient-dependent Manual defaults when switching from workspace to individual, while preserving explicit currency choices and entered expense data. Add regression coverage with differing workspace and Payment currencies.

What alternative solutions did you explore? (Optional)

A targeted forward fix is possible, but blindly resetting currency on every recipient change would overwrite user choices. An unset amount alone does not establish that currency is untouched.


Next Steps for Contributor+ team: To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/106689) to create a draft PR. To refine: @MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.


view run

MelvinBot avatar Nov 12 '26 10:11 MelvinBot

@twisterdotcom as the reporter of the original issue @jasperhuangg I am not even sure if this is a bug. And if it is, its independent of the original issue. Our code sets default currency once when the flow starts or when you change tabs (from Scan > Manual etc) We don't change currency when the user selects different participants. For instance, in my vid in production the payment currency is the default so the currency doesn't change when I select my default workspace whose currency is USD

https://github.com/user-attachments/assets/b1c9c226-b375-4bec-aa60-42c41a8b8a9c

If we need to change that behavior we need to set the expected behavior and handle it in this issue independently as a usual Daily issue, removing it from DP. WDYT

FitseTLT avatar Nov 12 '26 11:11 FitseTLT

yeah agreed, I don't think this needs to be a blocker. we can work on this separately.

we need to make it so that whenever payment To is selected we need to update it to either the workspace's default currency or the payment currency depending on if a workspace or individual is selected.

we don't need to block deploy on this and we should work on this as a separate follow-up improvement.

jasperhuangg avatar Nov 12 '26 21:11 jasperhuangg

@FitseTLT if you want to work on this one too since you have context feel free

jasperhuangg avatar Nov 12 '26 21:11 jasperhuangg

we need to make it so that whenever payment To is selected we need to update it to either the workspace's default currency or the payment currency depending on if a workspace or individual is selected.

Agree here.

twisterdotcom avatar Nov 12 '26 22:11 twisterdotcom

@MelvinBot a proposal for https://github.com/Expensify/App/issues/106689#issuecomment-6836895108

FitseTLT avatar Nov 12 '26 22:11 FitseTLT

Current assignee @FitseTLT is eligible for the External assigner, not assigning anyone new.

melvin-bot[bot] avatar Nov 12 '26 22:11 melvin-bot[bot]

Job added to Upwork: https://www.upwork.com/jobs/~022121003291635825570

melvin-bot[bot] avatar Nov 12 '26 22:11 melvin-bot[bot]

Proposal

What is the root cause of that problem?

Currency is initialized when the expense flow starts, but selecting a different To recipient updates participants without updating the currency.

Following the agreed behavior, this should be a follow-up improvement—not a revert or deploy blocker. This supersedes my earlier revert recommendation.

Code evidence

Both workspace and individual selections reach the shared confirmation-selection handler. It already receives the selected workspace policy and the user’s personal policy, but ordinary Manual selections do not update currency.

The participant picker forwards the selected workspace policy. The user’s Payment currency comes from their personal policy.

What changes do you think we should make in order to solve the problem?

For the reported Manual expense flow, update currency whenever a To selection is accepted:

  • Workspace: use the newly selected workspace’s currency.
  • Individual: use the current user’s Payment currency.
  • Apply this even if an amount or another currency was previously entered; do not restrict it to untouched defaults.
  • Change currency without reinitializing the expense, converting the amount, or clearing entered fields. Cancellation or a rejected selection should leave currency unchanged.

Keep existing rate-derived behavior for distance, per diem, and time expenses; extending this requirement to those flows needs separate confirmation.

Regression coverage

Test workspace A → individual → workspace B with three different currencies. Repeat with an unset amount, an entered amount, and an explicitly selected currency. Verify currency follows each accepted recipient selection while the stored amount, sign, receipt, and other fields remain intact.

Also cover a newly entered email and cancellation without selecting a recipient.

What alternative solutions did you explore? (Optional)

A continuous currency-sync effect could overwrite choices on unrelated rerenders. Updating at the accepted recipient-selection boundary directly implements the agreed behavior while retaining the workspace-default initialization improvement.

Validation: Source inspection only; no browser reproduction or tests executed.


Next Steps for Contributor+ team: To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/106689) to create a draft PR. To refine: @MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.


view run

MelvinBot avatar Nov 12 '26 22:11 MelvinBot

Proposal

Please re-state the problem that we are trying to solve in this issue.

When a user with a default workspace (e.g., workspace currency BDT) and a different personal Payment currency (e.g., AWG) starts creating a Manual expense from the global + button (Create expense -> Manual), the confirmation page initially defaults the recipient (To) to the default workspace and initializes the draft transaction currency to the workspace's outputCurrency (BDT) per PR #104024.

However, when the user taps the To field on the confirmation page and selects an individual user (or switches between workspaces/Self DM), the expense currency remains stuck on the initial default workspace currency (BDT) instead of updating to the user's personal Payment currency (personalPolicy?.outputCurrency, e.g., AWG) when an individual is selected, or to the newly selected workspace's outputCurrency when another workspace is selected.

What is the root cause of that problem?

  1. In src/hooks/useResetIOUType.ts:1067-1083 and src/pages/iou/request/IOURequestStartPage.tsx:167-182 (introduced by PR #104024), initMoneyRequest initializes transaction.currency using overrideCurrency ?? policy?.outputCurrency ?? personalPolicy?.outputCurrency ?? CONST.CURRENCY.USD (src/libs/actions/IOU/MoneyRequest.ts:386), where policy falls back to defaultPolicy from useDefaultParticipants (the user's active/default group workspace).
  2. When the user taps the To row on the confirmation page (DynamicIOURequestStepParticipants with isFromConfirmation === true), selecting a recipient invokes handleParticipantsAdded in src/hooks/useConfirmationParticipantSelection.ts:72-184:
    • In the shouldKeepOnSelfDM branch (lines 93-122), handleParticipantsAdded updates the distance rate via setCustomUnitRateID when isDistanceRequest is true, but never updates currency for Manual expenses (transactionToUpdate.iouRequestType === CONST.IOU.REQUEST_TYPE.MANUAL).
    • In the P2P individual branch (!isPolicyExpenseChatParticipant, lines 147-160), handleParticipantsAdded updates the P2P distance rate when isDistanceRequest is true and resets category and tag, but never calls setMoneyRequestCurrency to update the draft's currency to personalPolicy?.outputCurrency ?? CONST.CURRENCY.USD.
    • In the workspace branch (isPolicyExpenseChatParticipant, lines 161-184), handleParticipantsAdded updates the workspace distance rate and resets category/tag when switching workspaces, but never calls setMoneyRequestCurrency to update the draft's currency to workspacePolicy?.outputCurrency.

What changes do you think we should make in order to solve the problem?

In src/hooks/useConfirmationParticipantSelection.ts, update the draft transaction's currency via setMoneyRequestCurrency during handleParticipantsAdded for Manual expenses (transactionToUpdate.iouRequestType === CONST.IOU.REQUEST_TYPE.MANUAL, preserving rate-derived currency behavior for Distance, Per Diem, Time, and Scan flows) whenever a To recipient is selected:

  1. Import setMoneyRequestCurrency from @userActions/IOU/MoneyRequest in src/hooks/useConfirmationParticipantSelection.ts:7:
import {
    setCustomUnitRateID,
    setMoneyRequestCategory,
    setMoneyRequestCurrency,
    setMoneyRequestParticipants,
    setMoneyRequestParticipantsFromReport,
    setMoneyRequestTag,
} from '@userActions/IOU/MoneyRequest';
  1. Update currency in handleParticipantsAdded (src/hooks/useConfirmationParticipantSelection.ts) across all three recipient branches (shouldKeepOnSelfDM, individual P2P recipient, and workspace recipient) without resetting amount or other entered fields:
        if (shouldKeepOnSelfDM) {
            const selfDMCurrency = personalPolicy?.outputCurrency ?? CONST.CURRENCY.USD;
            for (const transactionToUpdate of transactions) {
                setMoneyRequestParticipantsFromReport(transactionToUpdate.transactionID, selfDMReport, currentUserPersonalDetails.accountID);
                setTransactionReport(transactionToUpdate.transactionID, {reportID: CONST.REPORT.UNREPORTED_REPORT_ID}, true);

                if (transactionToUpdate.iouRequestType === CONST.IOU.REQUEST_TYPE.MANUAL) {
                    setMoneyRequestCurrency(transactionToUpdate.transactionID, selfDMCurrency);
                }

                // A workspace rate doesn't exist on the self DM and would leave the Rate field "Pending...", so use the
                // self DM's own rate.
                if (isDistanceRequest) {

And inside the else block (lines 147-184):

                // A P2P recipient drops the workspace's rate, category and tag, like useParticipantSubmission does.
                if (!isPolicyExpenseChatParticipant) {
                    if (transactionToUpdate.iouRequestType === CONST.IOU.REQUEST_TYPE.MANUAL) {
                        setMoneyRequestCurrency(transactionIDToUpdate, personalPolicy?.outputCurrency ?? CONST.CURRENCY.USD);
                    }
                    if (isDistanceRequest) {
                        const p2pRateID = DistanceRequestUtils.getCustomUnitRateID({
                            reportID: firstParticipant.reportID,
                            isPolicyExpenseChat: false,
                            policy: undefined,
                            lastSelectedDistanceRates,
                            expenseDate: transactionToUpdate.created,
                        });
                        setCustomUnitRateID(transactionIDToUpdate, p2pRateID, transactionToUpdate, undefined, false, personalPolicy?.outputCurrency);
                    }
                    setMoneyRequestCategory(transactionIDToUpdate, '', undefined, getCurrencyDecimals);
                    setMoneyRequestTag(transactionIDToUpdate, '');
                } else {
                    const workspacePolicy = selectedPolicy;
                    if (transactionToUpdate.iouRequestType === CONST.IOU.REQUEST_TYPE.MANUAL && workspacePolicy?.outputCurrency) {
                        setMoneyRequestCurrency(transactionIDToUpdate, workspacePolicy.outputCurrency);
                    }
                    if (isDistanceRequest) {
  1. Add unit tests in tests/ui/components/DynamicIOURequestStepParticipantsTest.tsx covering:
    • Selecting an individual recipient from the confirmation To picker on a Manual expense updates the draft transaction's currency from the default workspace's outputCurrency to personalPolicy.outputCurrency while preserving amount and other fields.
    • Selecting a different workspace from the confirmation To picker updates the draft transaction's currency to selectedPolicy.outputCurrency.
    • Selecting an individual and then switching back to a workspace updates the currency to personalPolicy.outputCurrency and then to selectedPolicy.outputCurrency.

What alternative solutions did you explore? (Optional)

  • Syncing currency inside a useEffect in MoneyRequestConfirmationList / IOURequestStepConfirmation when policyID changes: Rejected because a reactive effect cannot distinguish between a recipient change and an explicit currency change made by the user on the confirmation step, and could overwrite user-selected currencies on re-render. Updating currency directly inside useConfirmationParticipantSelection's handleParticipantsAdded ties the currency update strictly to the user's explicit To selection action while keeping PR #104024's initial workspace currency default intact.

cocvn157 avatar Nov 13 '26 08:11 cocvn157

Proposal

What is the root cause of that problem?.

When initializing a manual expense from the global creation flow (PR #104024), the draft transaction's currency is initialized to the default workspace's outputCurrency.

When the user subsequently navigates to the participant selection step to change the recipient and confirms a new selection, useConfirmationParticipantSelection.ts executes handleParticipantsAdded (src/hooks/useConfirmationParticipantSelection.ts:134-181).

In lines 142–155, when selecting a non-workspace participant (!isPolicyExpenseChatParticipant), the logic correctly strips workspace-specific data (clearing the category with setMoneyRequestCategory and clearing the tag with setMoneyRequestTag), but it never updates the transaction's currency. Similarly, when selecting a new workspace policy chat (isPolicyExpenseChatParticipant), it fails to update the currency to the target workspacePolicy.outputCurrency. Because setMoneyRequestCurrency is never invoked during participant replacement, the transaction retains the original workspace currency.

What changes do you think we should make in order to solve the problem?

  1. Update transaction currency in useConfirmationParticipantSelection.ts: In src/hooks/useConfirmationParticipantSelection.ts:

    • Import setMoneyRequestCurrency from @userActions/IOU:
      import {setMoneyRequestCategory, setMoneyRequestCurrency, setMoneyRequestParticipants, setMoneyRequestTag} from '@userActions/IOU';
      
    • In handleParticipantsAdded, when shouldKeepOnSelfDM is true (lines 80–120):
      if (transactionToUpdate.iouRequestType === CONST.IOU.REQUEST_TYPE.MANUAL) {
          setMoneyRequestCurrency(transactionToUpdate.transactionID, personalPolicy?.outputCurrency ?? CONST.CURRENCY.USD);
      }
      
    • Inside the multi-participant loop when !isPolicyExpenseChatParticipant (P2P recipient, line 143):
      if (transactionToUpdate.iouRequestType === CONST.IOU.REQUEST_TYPE.MANUAL) {
          setMoneyRequestCurrency(transactionIDToUpdate, personalPolicy?.outputCurrency ?? CONST.CURRENCY.USD);
      }
      
    • Inside the else block when isPolicyExpenseChatParticipant is true (workspace recipient, line 156):
      const workspacePolicy = selectedPolicy;
      if (transactionToUpdate.iouRequestType === CONST.IOU.REQUEST_TYPE.MANUAL && workspacePolicy?.outputCurrency) {
          setMoneyRequestCurrency(transactionIDToUpdate, workspacePolicy.outputCurrency);
      }
      
  2. Automated Testing: Add unit test coverage in tests/ui/components/DynamicIOURequestStepParticipantsTest.tsx:

    • Starting a Manual expense under a workspace with EUR and changing the recipient to a personal contact updates the draft transaction currency to USD (personalPolicy.outputCurrency).
    • Changing the recipient from a personal contact to a workspace updates the currency to that workspace's outputCurrency.
    • Changing from one workspace to another workspace updates the currency to the second workspace's outputCurrency.

What alternative solutions did you explore? (Optional)

  • Setting up a useEffect inside IOURequestStepConfirmation listening to transaction.participants: Rejected because a reactive effect cannot reliably distinguish between a programmatic participant change and an intentional manual currency override selected by the user on the confirmation step, which could cause accidental currency overwrites. Updating directly inside useConfirmationParticipantSelection ensures currency switching occurs only in direct response to the user's explicit recipient change.

Contributor details

Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0131dae36abcf59374

kevinjosh10 avatar Nov 14 '26 00:11 kevinjosh10

Proposal

What is the root cause of that problem?

When creating a Manual expense through global create (FAB > Create expense > Manual), the transaction draft is initialized with the default workspace's currency (defaultPolicy.outputCurrency).

When the user subsequently clicks the "To" field on the confirmation page and selects an individual personal contact (a non-workspace P2P recipient), useConfirmationParticipantSelection.ts's handleParticipantsAdded clears workspace-specific fields (category and tag via setMoneyRequestCategory and setMoneyRequestTag), but it does not invoke setMoneyRequestCurrency. Because currency is never synchronized when replacing the participant, the transaction remains locked in the original default workspace's currency instead of resetting to the member's personal payment currency (personalPolicy.outputCurrency).

What changes do you think we should make in order to solve the problem?

  1. In src/hooks/useConfirmationParticipantSelection.ts:
    • Import setMoneyRequestCurrency from @userActions/IOU/MoneyRequest.
    • In handleParticipantsAdded, when selecting a P2P recipient (!isPolicyExpenseChatParticipant) and for non-distance manual requests, call setMoneyRequestCurrency to reset the draft transaction's currency to the member's payment currency (personalPolicy?.outputCurrency ?? CONST.CURRENCY.USD).
    • Similarly, if the user moves the expense to Self-DM (shouldKeepOnSelfDM), synchronize the currency with the personal payment currency.
    • When switching from one workspace to another workspace (isPolicyExpenseChatParticipant), update the transaction currency to the new workspacePolicy.outputCurrency.
  2. In src/hooks/useParticipantSubmission.ts:
    • Mirror this currency synchronization logic inside goToNextStep for standalone participant selection flows so behavior remains consistent across all creation entry points.
  3. Add unit test coverage in tests/ui/components/IOURequestStepConfirmationPageTest.tsx verifying that switching recipient from a default workspace to a personal contact updates the draft currency to the personal payment currency, and switching to a new workspace updates it to the target workspace currency.

What alternative solutions did you explore? (Optional)

Using a reactive useEffect inside IOURequestStepConfirmation listening to participant changes was considered and rejected. A reactive effect cannot reliably distinguish between a programmatic participant change and an intentional manual currency override selected by the user on the confirmation page, which risks overwriting user-chosen currencies. Updating directly inside handleParticipantsAdded ensures the currency switch occurs strictly in direct response to the recipient change.

Contributor details

Your Expensify account email: [email protected]

gorky117-cell avatar Nov 15 '26 08:11 gorky117-cell

@FitseTLT feel free to move forward with Melvin's proposal here, LGTM

jasperhuangg avatar Nov 16 '26 20:11 jasperhuangg

@FitseTLT any updates on this one?

jasperhuangg avatar Nov 18 '26 17:11 jasperhuangg

@jasperhuangg When should currency change, always when a user select participant? I feel like we change it to payment currency for p2p and the selected workspaces currency for workspaces only when not isAmountSet so that if a user inserted amount/currency value we shouldn't change WDYT. cc @twisterdotcom

FitseTLT avatar Nov 18 '26 19:11 FitseTLT