Skip to content

[Due for payment 2025-09-19] [Due for payment 2025-09-09] Reports - App crashes when deleting invoice via dropdown button when there is no selection #69344

Closed

Description

@mitarachim

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.1.99-5
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from TestRail: Exp https://test-management.browserstack.com/projects/2219752/test-runs/TR-439/folder/13176671/41237466/861418696
Email or phone of affected tester (no customers): sdhusdhbidshius@gmail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.5 / Chrome
App Component: Search

Action Performed:

Precondition:

  • Invoice is enabled.
  1. Go to staging.new.expensify.com
  2. Open FAB > Send invoice.
  3. Send two invoices to any user.
  4. Go to Reports > Expenses.
  5. Click Type:Expense.
  6. Select Invoice and click Apply.
  7. Select an invoice via checkbox.
  8. Click on the selected invoice.
  9. Click More > Delete.
  10. Delete the invoice.
  11. Click on the green dropdown button.
  12. Click Delete > Delete.

Expected Result:

App will not crash.

Actual Result:

App crashes.

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

Bug6928063_1756290954289.Screen_Recording_2025-08-27_at_18.31.45.mp4

Bug6928063_1756290954294!staging.new.expensify.com-1756290747267.txt

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @sakluger

Activity

  1. added
    DeployBlockerCash
    Daily
    Bug
    DeployBlocker
    on Aug 27, 2025
  2. melvin-bot commented on Aug 27, 2025

    @melvin-bot

    Triggered auto assignment to @sakluger (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 Aug 27, 2025

    @melvin-bot

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

  4. melvin-bot commented on Aug 27, 2025

    @melvin-bot

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

  5. github-actions commented on Aug 27, 2025

    @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. lakchote commented on Aug 27, 2025

    @lakchote
    Contributor
  7. ShridharGoel commented on Aug 27, 2025

    @ShridharGoel
    Contributor

    Proposal

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

    When a user selects invoices via checkbox in the Reports > Expenses page, then deletes those invoices individually (by clicking on the invoice and using More > Delete), the bulk actions dropdown remains visible even though no items are selected anymore. When the user then clicks on the dropdown and tries to delete, the app crashes because it attempts to perform bulk operations on empty selections.

    What is the root cause of that problem?

    The root cause is in the Search component's useEffect that manages selectedTransactions state. When transactions are deleted individually (not through bulk actions), the component correctly identifies that no selected transactions exist in the current data, but it has an early return that prevents clearing the selectedTransactions state:

    See: src/components/Search/index.tsx:445-450

    if (isEmptyObject(newTransactionList)) {
        return; // This prevents clearing selectedTransactions
    }
    setSelectedTransactions(newTransactionList, data);

    This means the selectedTransactions state still contains references to deleted transactions, causing the bulk actions dropdown to remain visible with stale data.

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

    We need to remove the early return when newTransactionList is empty in the Search component's useEffect. This will ensure that setSelectedTransactions is always called, properly clearing the selected transactions state when all selected items have been deleted individually.

    File link: src/components/Search/index.tsx

    Change needed:

    // Remove these lines:
    if (isEmptyObject(newTransactionList)) {
        return;
    }

    This ensures the selected transactions state is always synchronized with the current search results data.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    We can have unit tests or integration tests for this.

  8. 8 remaining items

  9. removed
    DeployBlockerCash
    on Aug 28, 2025
  10. added
    Weekly
    Awaiting Payment
    and removed
    Hourly
    on Sep 2, 2025
  11. changed the title [-]Reports - App crashes when deleting invoice via dropdown button when there is no selection[/-] [+][Due for payment 2025-09-09] Reports - App crashes when deleting invoice via dropdown button when there is no selection[/+] on Sep 2, 2025
  12. melvin-bot commented on Sep 2, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  13. removed
    Reviewing
    on Sep 2, 2025
  14. melvin-bot commented on Sep 2, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.0-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2025-09-09. 🎊

  15. melvin-bot commented on Sep 2, 2025

    @melvin-bot

    @lakchote @sakluger The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  16. added
    Weekly
    and removed
    Weekly
    on Sep 12, 2025
  17. changed the title [-][Due for payment 2025-09-09] Reports - App crashes when deleting invoice via dropdown button when there is no selection[/-] [+][Due for payment 2025-09-19] [Due for payment 2025-09-09] Reports - App crashes when deleting invoice via dropdown button when there is no selection[/+] on Sep 12, 2025
  18. melvin-bot commented on Sep 12, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.12-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2025-09-19. 🎊

  19. melvin-bot commented on Sep 12, 2025

    @melvin-bot

    @lakchote @sakluger The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

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

Metadata

Metadata

Labels

Awaiting PaymentBugEngineeringWeekly

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions