Skip to content

[Due for payment 2025-10-23] Workspace - Disabling a toggle in Expense Reports triggers eReceipts to Enabled in non-USD WS #69565

Closed

Description

@vincdargento

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.2.0-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: https://test-management.browserstack.com/projects/2219752/test-runs/TR-570/folder/13176707/41236886/867880396
Email or phone of affected tester (no customers): biruknew45+29lmmml7@gmail.com
Issue reported by: Applause Internal Team
Device used: Web, mweb, android
App Component: Workspace Settings

Action Performed:

  1. Go to https://staging.new.expensify.com/
  2. Create a Workspace (non-USD)
  3. Go to More features and enable Rules
  4. Go to Rules > enable one of the toggle from Expense Reports section
  5. Go offline
  6. Disable the toggle turned on in step 4
  7. Go online

Expected Result:

Disabling a toggle in the Expense Reports section while offline should not automatically enable eReceipts

Actual Result:

When a toggle in the Expense Reports section is disabled while offline, eReceipts are automatically enabled for non-USD workspaces once the app goes back online.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

bug.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @VictoriaExpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 29, 2025
  2. melvin-bot commented on Aug 29, 2025

    @melvin-bot

    Triggered auto assignment to @VictoriaExpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. danilomarkovic99 commented on Aug 31, 2025

    @danilomarkovic99

    Contributor details
    Expensify account email: danilo.markovic.dm@gmail.com
    Upwork Profile link: https://www.upwork.com/freelancers/~016340fa4ac4f99e69

    Problem Summary

    In non-USD workspaces, when a user toggles any “Expense Report” rule (e.g., Prevent Self-Approval, Auto-Approval, Auto-Reimburse) while offline, the app unexpectedly sets eReceipts to enabled after reconnecting. This regression affects multiple platforms and was reproduced in staging and production.

    Root Cause

    The Individual Expense Rules screen (IndividualExpenseRulesSection) renders the eReceipts toggle using a reusable Switch component. Even though the switch is visually disabled for non‑USD currencies
    (disabled={policyCurrency !== CONST.CURRENCY.USD}),
    it still wires up an onToggle callback to setWorkspaceEReceiptsEnabled(policyID, !areEReceiptsEnabled)
    If any other rule is toggled offline, queued updates merge policy data when reconnecting. Because getWorkspaceEReceiptsEnabledOnyxData misconfigures its failure‑recovery payload, it writes back pendingFields.defaultBillable. This leaves pendingFields.eReceipts stale and can cause the offline queue to reapply a previous eReceipts value (typically true) when reconciling requests.

    Proposed Fix

    1. Correct the Onyx failure payload for eReceipts
    In getWorkspaceEReceiptsEnabledOnyxData, replace the defaultBillable keys with eReceipts in the failureData section. The function should revert only the eReceipts field and its pending/error fields on failure
    his ensures other updates don’t inadvertently reset eReceipts.

    2. Guard the eReceipts action in the UI
    Modify IndividualExpenseRulesSection.tsx so that the onToggle handler checks policyCurrency === CONST.CURRENCY.USD before calling setWorkspaceEReceiptsEnabled. Alternatively, pass a no‑op disabledAction prop to the Switch so the pressable is disabled correctly. This prevents accidental dispatches of the eReceipts API in non‑USD workspaces, even if the component receives spurious clicks

    3. Early exit in the action
    Add a defensive early return in setWorkspaceEReceiptsEnabled so that if the workspace’s outputCurrency !== USD the function simply returns. This enforces the currency constraint at the action layer in case future callers omit the check.

    4. Audit other rule actions
    Verify that other actions in the Expense Reports and Individual Expense Rules sections (setPolicyPreventSelfApproval, enableAutoApprovalOptions, etc.) do not queue or merge unrelated fields. Confirm there is no call site that toggles eReceipts outside of USD policies.

    Acceptance Criteria

    • In non‑USD workspaces, toggling any rule in Expense Reports while offline and then going online does not enable eReceipts.
    • The eReceipts toggle does not trigger any action or network call in non‑USD workspaces.
    • The pendingFields and errorFields for eReceipts are correctly cleared on success/failure.
    • All related settings work correctly in USD workspaces.
    • Manual testing across Android (app & web), iOS (app & web), Windows Chrome, macOS Chrome/Safari/Desktop reproduces the original issue on main and confirms the fix.

    Test Plan

    • Set up a non‑USD workspace on staging.
    • Baseline: Ensure eReceipts is disabled. Enable one Expense Report rule. Go offline, disable it, then reconnect. Confirm eReceipts remains disabled.
    • Repeat steps for each rule in both the Expense Report Rules and Individual Expense Rules sections.
    • Switch to USD workspace and verify that eReceipts can still be toggled normally and that failure scenarios roll back correctly.
    • Use dev tools to inspect Onyx pendingFields for eReceipts before and after offline/online transitions.
  4. melvin-bot commented on Aug 31, 2025

    @melvin-bot

    📣 @danilomarkovic99! 📣
    Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
    Please follow these steps:

    1. Make sure you've read and understood the contributing guidelines.
    2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
    3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  5. danilomarkovic99 commented on Aug 31, 2025

    @danilomarkovic99

    📣 @danilomarkovic99! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

    1. Make sure you've read and understood the contributing guidelines.
    2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
    3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    

    I've already included contributor details in my previous comment. Sharing it here separately.

    Contributor details
    Expensify account email: danilo.markovic.dm@gmail.com
    Upwork Profile link: https://www.upwork.com/freelancers/~016340fa4ac4f99e69

  6. melvin-bot commented on Sep 1, 2025

    @melvin-bot

    @VictoriaExpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

  7. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Sep 2, 2025
  8. melvin-bot commented on Sep 2, 2025

    @melvin-bot

    Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.

  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Sep 2, 2025
  10. melvin-bot commented on Sep 2, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @truph01 (External)

  11. 49 remaining items

  12. removed
    Awaiting PaymentAuto-added when associated PR is deployed to production
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 28, 2025
  13. truph01 commented on Nov 3, 2025

    @truph01
    Contributor

    @VictoriaExpensify I'm not eligible for NewDot payment yet, please send me the Upwork offer, thank you!

  14. VictoriaExpensify commented on Nov 13, 2025

    @VictoriaExpensify
    Contributor

    Oh sorry @truph01 , I don't know why I thought you were! Sending an offer now

  15. VictoriaExpensify commented on Nov 14, 2025

    @VictoriaExpensify
    Contributor
  16. VictoriaExpensify commented on Nov 14, 2025

    @VictoriaExpensify
    Contributor
  17. VictoriaExpensify commented on Nov 16, 2025

    @VictoriaExpensify
    Contributor

    Updated Payment summary:
    C: @thelullabyy - Paid $250 via Upwork
    C+: @truph01 - Paid $250 via Upwork

  18. thelullabyy commented on Jan 30, 2026

    @thelullabyy
    Contributor

    Kindly bump for payout on upwork

  19. thelullabyy commented on Feb 12, 2026

    @thelullabyy
    Contributor

    @VictoriaExpensify could you please check this comment? Thanks

  20. VictoriaExpensify commented on Feb 24, 2026

    @VictoriaExpensify
    Contributor

    @thelullabyy and I have chatted 1:1, this is now resolved

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

Metadata

Metadata

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions