Skip to content

[Due for payment 2026-06-03] [$250] Bulk expense edit hangs and crashes on large reports #90707

Closed

Description

@marcaaron

Problem

When a report has many expenses (40-50+), if you bulk edit them (e.g. toggle billable to false for all), the UI hangs noticeably and the browser tab can become unresponsive.

Solution

Two changes needed here:

  • The bulk edit flow makes an unnecessary report reload after each individual expense update, causing a flood of operations. This call should be removed.
  • The save button should show a loading spinner while the edits are processing so users know something's happening and don't keep clicking.
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022054987899835140509
  • Upwork Job ID: 2054987899835140509
  • Last Price Increase: 2026-06-11
Issue OwnerCurrent Issue Owner: @rojiphil

Activity

  1. self-assigned this
    on May 14, 2026
  2. marcaaron commented on May 14, 2026

    @marcaaron
    ContributorAuthor

    Dug into the root cause a bit. The performance problem is coming from createTransactionThreadReport being called inside the bulk edit loop for each expense that doesn't already have a local transaction thread (i.e. has never been individually opened). That function unconditionally calls openReport, which fires an OpenReport API command AND does a batch of Onyx writes per expense (a SET on the report, a SET on report actions, isLoadingInitialReportActions: true on REPORT_METADATA, etc.). On a report with 40-50 expenses that have never been clicked open, every single one hits this path, so you end up with up to 50 OpenReport calls stacked on top of 50 UpdateMoneyRequest calls. The synchronous Onyx writes from all those openReport calls in rapid succession are what hangs the main thread.

    The good news is the OpenReport call is completely unnecessary here. The Auth backend already creates the transaction thread when it doesn't exist as part of processing UpdateMoneyRequest — MoneyRequest::createModifiedActionAndUpdateReportPreview checks transactionThreadReportID == 0 and calls createTransactionThread itself before writing the MODIFIED_EXPENSE action. The user is also never navigated to the thread, so there's nothing to fetch from the server anyway.

    The fix should be to replace the createTransactionThreadReport call in the bulk edit loop with a lighter local-only setup that just writes the optimistic thread and CREATED action to Onyx directly, without firing any API command. One thing to double-check: the existing CREATED action backfill logic in the loop (BulkEdit.ts around line 433) currently skips writing a CREATED action when the thread was "just created above" (because openReport handles it). After the change, that guard will need to be updated so the CREATED action is always written locally.

  3. marcaaron commented on May 14, 2026

    @marcaaron
    ContributorAuthor

    @MelvinBot Can you implement a fix for this?

  4. added
    External
    on May 14, 2026
  5. added
    Help Wanted
    on May 14, 2026
  6. added
    Bug
    on May 14, 2026
  7. melvin-bot commented on May 14, 2026

    @melvin-bot

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

  8. wildan-m commented on May 14, 2026

    @wildan-m
  9. melvin-bot commented on May 14, 2026

    @melvin-bot
  10. changed the title [-]Bulk expense edit hangs and crashes on large reports[/-] [+][$250] Bulk expense edit hangs and crashes on large reports[/+] on May 14, 2026
  11. removed
    External
    Help Wanted
    on May 14, 2026
  12. 54 remaining items

  13. mallenexpensify commented on Jun 8, 2026

    @mallenexpensify
    Contributor

    @rojiphil plz complete the BZ checklist and tag me in a post once you have. Thx

  14. melvin-bot commented on Jun 11, 2026

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  15. mallenexpensify commented on Jun 11, 2026

    @mallenexpensify
    Contributor

    @rojiphil plz complete the BZ checklist and tag me in a post once you have. Thx

  16. melvin-bot commented on Jun 11, 2026

    @melvin-bot

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

  17. melvin-bot commented on Jun 12, 2026

    @melvin-bot

    @rojiphil Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  18. rojiphil commented on Jun 14, 2026

    @rojiphil
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment Primarily a performance improvement with additional support for loading spinner for save button.

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: Not Required. The existing checklist is good enough to capture such issues.

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal Template

    Regression Test Proposal

    Precondition:

    Create 40+ reports with at least one expense

    Test:

    1. Login to Staging Expensify (If logged-in already, logout and login again)
    2. Navigate to Spend->Expenses.
    3. Go Offline
    4. Select all expenses such that Edit multiple menu option is available for selected expenses.
    5. Select Edit multiple menu option for selected expenses.
    6. Select, Edit and Save any editable field (e.g. Description).
    7. Select Save in the Edit multiple expenses page.
    8. Verify that the loading spinner is shown on Save button and is disabled
    9. Click/tap the edited expense report and verify that the modified expense message is displayed (Skeleton may be shown if the report is not loaded yet)
    10. Go Online and wait for all updates to be completed.
    11. Click/tap edited expense report and verify that the modified expense message is displayed.

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-4a8b-a4c1-6102-0e478df26af4
  19. rojiphil commented on Jun 14, 2026

    @rojiphil
    Contributor

    plz complete the BZ checklist and tag me in a post once you have. Thx

    @mallenexpensify BZ Checklist done. Thanks.

  20. quinthar commented on Jun 29, 2026

    @quinthar
    Contributor

    Approved $250 to @rojiphil

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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyEngineeringExternalHelp Wanted

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions