You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-06-03] [$250] Bulk expense edit hangs and crashes on large reports #90707
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors
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.
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.
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
[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
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors
Activity
marcaaron commentedon May 14, 2026
Dug into the root cause a bit. The performance problem is coming from
createTransactionThreadReportbeing 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 callsopenReport, which fires anOpenReportAPI command AND does a batch of Onyx writes per expense (aSETon the report, aSETon report actions,isLoadingInitialReportActions: trueonREPORT_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 50OpenReportcalls stacked on top of 50UpdateMoneyRequestcalls. The synchronous Onyx writes from all thoseopenReportcalls in rapid succession are what hangs the main thread.The good news is the
OpenReportcall is completely unnecessary here. The Auth backend already creates the transaction thread when it doesn't exist as part of processingUpdateMoneyRequest—MoneyRequest::createModifiedActionAndUpdateReportPreviewcheckstransactionThreadReportID == 0and callscreateTransactionThreaditself before writing theMODIFIED_EXPENSEaction. 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
createTransactionThreadReportcall in the bulk edit loop with a lighter local-only setup that just writes the optimistic thread andCREATEDaction to Onyx directly, without firing any API command. One thing to double-check: the existing CREATED action backfill logic in the loop (BulkEdit.tsaround line 433) currently skips writing a CREATED action when the thread was "just created above" (becauseopenReporthandles it). After the change, that guard will need to be updated so the CREATED action is always written locally.marcaaron commentedon May 14, 2026
@MelvinBot Can you implement a fix for this?
melvin-bot commentedon May 14, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rojiphil (
External)wildan-m commentedon May 14, 2026
melvin-bot commentedon May 14, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022054987899835140509
[-]Bulk expense edit hangs and crashes on large reports[/-][+][$250] Bulk expense edit hangs and crashes on large reports[/+]54 remaining items
mallenexpensify commentedon Jun 8, 2026
@rojiphil plz complete the BZ checklist and tag me in a post once you have. Thx
melvin-bot commentedon Jun 11, 2026
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
mallenexpensify commentedon Jun 11, 2026
@rojiphil plz complete the BZ checklist and tag me in a post once you have. Thx
melvin-bot commentedon Jun 11, 2026
@rojiphil Whoops! This issue is 2 days overdue. Let's get this updated quick!
melvin-bot commentedon Jun 12, 2026
@rojiphil Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
rojiphil commentedon Jun 14, 2026
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.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/648722
Regression Test Proposal
Precondition:
Create 40+ reports with at least one expense
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-4a8b-a4c1-6102-0e478df26af4rojiphil commentedon Jun 14, 2026
@mallenexpensify BZ Checklist done. Thanks.
quinthar commentedon Jun 29, 2026
Approved $250 to @rojiphil