Skip to content

Android - Expense report - Reports disappear when employee create expense #80194

Closed

Description

@jponikarchuk

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: v9.3.6-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://test-management.browserstack.com/projects/2219752/test-runs/TR-3236/folder/13176741/41237130/1141128004
Email or phone of affected tester (no customers): ndk.2303+212@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Critical User Impact
Device used: Android 16 / Pixel 7A
App Component: Money Requests

Action Performed:

Preconditions:

  • Account A create a workspace and invite Account B as employee member
  1. Open hybrid app
  2. As account B in a secondary device, create an expense in workspace chat
  3. Navigate back to workspace chat
  4. As account A, navigate to workspace settings
  5. Open Workflows
  6. Disable Add Approval and Payment
  7. As account B, navigate to workspace
  8. As account A, navigate to account B workspace chat
  9. As account B, create another expense report
  10. Submit the expense report
  11. Repeat Step 8-10

Expected Result:

All expense reports should be present

Actual Result:

At step 9, expense reports disappear except the first expense report
At step 6, the created expense report disappear in employee side

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCash
    Bug
    on Jan 22, 2026
  2. melvin-bot commented on Jan 22, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (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. melvin-bot commented on Jan 22, 2026

    @melvin-bot

    Triggered auto assignment to @Valforte (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  4. melvin-bot commented on Jan 22, 2026

    @melvin-bot

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

  5. github-actions commented on Jan 22, 2026

    @github-actions
    Contributor

    👋 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.
  6. removed
    Hourly
    Bug
    on Jan 22, 2026
  7. 12 remaining items

  8. github-actions commented on Jan 22, 2026

    @github-actions
    Contributor

    👋 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.
  9. OSBotify commented on Jan 22, 2026

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #78853 - "Remove Onyx.connect() for the key: ONYXKEYS.BETAS in src/libs/ReportUtils.ts" by @Krishna2323 (High confidence)
    Related Issues: None

    Recommendation: REVERT

    PR #78853 refactored getExpenseReportStateAndStatus() to require an allBetas parameter instead of using a module-level Onyx.connect(). This introduces a critical issue where expense reports can receive incorrect state/status values if allBetas is not properly initialized in all code paths, causing reports to be incorrectly filtered from the LHN.

    Labels: This is a Frontend bug. The issue currently has DeployBlockerCash label, which is correct - this should block the App deploy. No label changes needed.

    Detailed Analysis

    Evidence

    PR #78853 was merged on 2026-01-21 at 17:05:02Z and is included in v9.3.6-0 staging deploy. The PR refactored getExpenseReportStateAndStatus() from using a module-level Onyx.connect() to requiring allBetas as a parameter:

    Before (module-level connection):

    let allBetas: OnyxEntry<Beta[]>;
    Onyx.connectWithoutView({
        key: ONYXKEYS.BETAS,
        callback: (value) => (allBetas = value),
    });
    
    function getExpenseReportStateAndStatus(policy: OnyxEntry<Policy>, isEmptyOptimisticReport = false) {
        const isASAPSubmitBetaEnabled = Permissions.isBetaEnabled(CONST.BETAS.ASAP_SUBMIT, allBetas);
        // ... logic
    }

    After (parameter-based):

    function getExpenseReportStateAndStatus(policy: OnyxEntry<Policy>, allBetas: OnyxEntry<Beta[]>, isEmptyOptimisticReport = false) {
        const isASAPSubmitBetaEnabled = Permissions.isBetaEnabled(CONST.BETAS.ASAP_SUBMIT, allBetas);
        // ... logic
    }

    This function is critical because it determines the stateNum and statusNum of expense reports, which are used by the LHN filtering logic.

    Root Cause

    The reported bug shows expense reports disappearing when:

    1. Account B creates an expense in workspace chat
    2. Account A changes workflow settings (disables "Add Approval and Payment")
    3. Account B creates another expense report
    4. Reports disappear except the first one

    This behavior is consistent with the LHN filtering logic at src/libs/ReportUtils.ts:9531:

    // Hide empty reports that have only a CREATED action, a total of 0, and are in a submitted state
    if (report?.total === 0 && report?.stateNum === CONST.REPORT.STATE_NUM.SUBMITTED && report?.statusNum === CONST.REPORT.STATUS_NUM.SUBMITTED && hasOnlyCreatedAction) {
        return null;  // Hide from LHN
    }

    The problem: If allBetas is undefined or not properly passed when expense reports are being created/updated (particularly during workflow setting changes), getExpenseReportStateAndStatus() may return incorrect state/status values. This causes reports to match the filtering criteria above and be hidden from the LHN.

    Verification

    The PR modifies critical files:

    • src/libs/ReportUtils.ts - Core report utility functions including getExpenseReportStateAndStatus(), buildOptimisticExpenseReport(), buildOptimisticEmptyReport()
    • src/libs/actions/IOU/index.ts - IOU/Expense creation actions
    • Multiple components that create or display expense reports

    The timing matches perfectly:

    • PR merged: 2026-01-21 17:05:02Z
    • Issue reported: 2026-01-22 08:27:15Z
    • Version: v9.3.6-0 (current staging deploy)
    • Reproducible: Staging only (not production)

    The issue specifically occurs when workflow settings are changed, which suggests a code path where allBetas might not be properly available during report state updates triggered by policy changes.

    Technical Details

    The refactoring added allBetas parameter to:

    • getExpenseReportStateAndStatus() - Determines report state/status
    • buildOptimisticExpenseReport() - Creates expense reports optimistically
    • buildOptimisticEmptyReport() - Creates empty expense reports
    • doesReportContainRequestsFromMultipleUsers() - Checks if report has multiple users
    • canCreateRequest() - Validates if request can be created
    • shouldCreateNewMoneyRequestReport() - Determines if new report should be created

    While most UI components were updated to pass allBetas using useOnyx(ONYXKEYS.BETAS), there may be asynchronous updates or background processes triggered by policy changes that don't have access to the properly initialized allBetas value, leading to incorrect report states.

  10. melvin-bot commented on Jan 22, 2026

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  11. Valforte commented on Jan 22, 2026

    @Valforte
    Contributor

    This is a pretty wide issue that can possibly reach many customers so I think the best course of action is to revert the offending PR.

  12. Beamanator commented on Jan 22, 2026

    @Beamanator
    Contributor

    @Valforte did you request CP for that revert?

    • Edit: I just requested
  13. IuliiaHerets commented on Jan 22, 2026

    @IuliiaHerets

    Xiaomi Redmi Note 10 / Android 12
    App 9.3.6-3
    After creating the third expense report (employee), expenses disappear on the admin side and only an empty report is shown. The admin must reopen the LHN to see the expenses

    Screenrecorder-2026-01-22-19-49-45-530.mp4
  14. Beamanator commented on Jan 22, 2026

    @Beamanator
    Contributor

    asked for retest, as most likely now that fire is out this should be fixed

  15. m-natarajan commented on Jan 22, 2026

    @m-natarajan

    Not reproduce ,Xiaomi Redmi Note 10 / Android 12, App 9.3.6-4

    Screenrecorder-2026-01-22-22-31-54-69.mp4
  16. Beamanator commented on Jan 22, 2026

    @Beamanator
    Contributor

    Perfecto, thanks! Closing!

  17. removed
    DeployBlockerCash
    on Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugEngineeringHourly

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions