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 2025-09-19] [$250] Reports - Deleted expense is unselected before disappearing #66028
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Version Number: 9.1.80-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from TestRail:#65727 Email or phone of affected tester (no customers): N/A Issue reported by: Applause Internal Team Device used: Samsung Galaxy A52s 5G / Android 14, Apple iPhone 12 Pro / iOS 18.5 App Component: Search
Action Performed:
Open the app
Log in with a new expensifail account
Tap on "Reports"
Tap on FAB - Create expense - Manual
Create an expense with a Gmail account
Select the expense
Tap on the "1 selected" button
Tap on "Delete"
Tap on the "Delete" button
Expected Result:
Deleted expense should disappear instantly.
Actual Result:
Deleted expense is unselected before disappearing.
Also, we clear the selection immediately after the user confirms deletion, but the item stays on the screen until the backend responds. This causes a brief moment where the item is deselected but still visible.
If we want deleted items (those with pendingAction) to disappear from the search results immediately, I believe that’s already being handled in this PR. If not, we can handle it here after that PR is merged.
Here’s a demo of the fix:
Fix.66028.mp4
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
What alternative solutions did you explore? (Optional)
Delaying the clearing of selection until after backend confirmation.
Even though we already wrap the clearSelectedTransactions in runAfterInteractions, it's still executed earlier before the API response that delete the transaction data from the snapshot.
(and the failure data that removes the pending action when fail)
Next, we need to move deleteMoneyRequestOnSearch inside the runAfterInteractions too, otherwise, the expense is deleted earlier before the item is unselected (which will show 1 selected even though the expense is not shown anymore).
// Translations copy for delete modal depends on amount of selected items,
// We need to wait for modal to fully disappear before clearing them to avoid translation flicker between singular vs plural
InteractionManager.runAfterInteractions(()=>{
clearSelectedTransactions();
});
};
Last, we need to update isSearchResultsEmpty to filter out pending delete transactions.
function isSearchResultsEmpty(searchResults: SearchResults) {
return !Object.values(searchResults?.data).some((data) => 'transactionID' in data && (data as SearchTransaction)?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE);
}
With all these changes, when deleting expense, the empty view will show immediately (when no expense left)
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
We can test Search.deleteMoneyRequestOnSearch and assert all the transaction pendingAction is set to delete
changed the title [-]Reports - Deleted expense is unselected before disappearing[/-][+][$250] Reports - Deleted expense is unselected before disappearing[/+]on Jul 15, 2025
Issue is ready for payment but no BZ is assigned. @OfstadC you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks!
[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: N/A
[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.
It's small UX issue that I think we don't need a regression test for it.
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Activity
melvin-bot commentedon Jul 14, 2025
Triggered auto assignment to @lydiabarclay (
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.mohammadjafarinejad commentedon Jul 14, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Deleted expense is unselected before disappearing.
What is the root cause of that problem?
The
deleteMoneyRequestOnSearch()function does not optimistically update the transaction list.App/src/libs/actions/Search.ts
Lines 388 to 390 in 46278af
Also, we clear the selection immediately after the user confirms deletion, but the item stays on the screen until the backend responds. This causes a brief moment where the item is deselected but still visible.
App/src/pages/Search/SearchPage.tsx
Lines 380 to 386 in 46278af
What changes do you think we should make in order to solve the problem?
We can update the
deleteMoneyRequestOnSearch()to include optimistic data:Also we should call
deleteMoneyRequestOnSearch()next toclearSelectedTransactions(), so both updates happens at the same timeIf we want deleted items (those with pendingAction) to disappear from the search results immediately, I believe that’s already being handled in this PR. If not, we can handle it here after that PR is merged.
Here’s a demo of the fix:
Fix.66028.mp4
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
What alternative solutions did you explore? (Optional)
bernhardoj commentedon Jul 14, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
When deleting expense from search, the item is deselected first for a while before it's removed from the list.
What is the root cause of that problem?
We currently only optimistically update the loading data.
App/src/libs/actions/Search.ts
Lines 388 to 391 in 3ee664b
Even though we already wrap the
clearSelectedTransactionsinrunAfterInteractions, it's still executed earlier before the API response that delete the transaction data from the snapshot.App/src/pages/Search/SearchPage.tsx
Lines 374 to 387 in 3ee664b
What changes do you think we should make in order to solve the problem?
First, we need to optimistically update the transaction data in the snapshot.
(and the failure data that removes the pending action when fail)
Next, we need to move
deleteMoneyRequestOnSearchinside therunAfterInteractionstoo, otherwise, the expense is deleted earlier before the item is unselected (which will show 1 selected even though the expense is not shown anymore).App/src/pages/Search/SearchPage.tsx
Lines 374 to 387 in 3ee664b
Last, we need to update
isSearchResultsEmptyto filter out pending delete transactions.With all these changes, when deleting expense, the empty view will show immediately (when no expense left)
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
We can test
Search.deleteMoneyRequestOnSearchand assert all the transactionpendingActionis set to deletemelvin-bot commentedon Jul 15, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021945012587501504085
[-]Reports - Deleted expense is unselected before disappearing[/-][+][$250] Reports - Deleted expense is unselected before disappearing[/+]Beamanator commentedon Jul 15, 2025
Looks like an external issue! (sorry for randomly popping in 😅 )
melvin-bot commentedon Jul 15, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @hoangzinh (
External)hoangzinh commentedon Jul 17, 2025
Thank you for posting proposals, @bernhardoj @mohammadjafarinejad. I will review them soon
70 remaining items
lydiabarclay commentedon Sep 19, 2025
Payment Summary
Contributor: @bernhardoj due $250 via NewDot
Contributor+: @hoangzinh due $250 via NewDot
✅ Regression test filed
melvin-bot commentedon Sep 19, 2025
Issue is ready for payment but no BZ is assigned. @OfstadC you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks!
bernhardoj commentedon Sep 20, 2025
Requested in ND.
hoangzinh commentedon Sep 22, 2025
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
[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: https://github.com/Expensify/App/pull/44385/files#r2368969588
[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: N/A
[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.
It's small UX issue that I think we don't need a regression test for it.
hoangzinh commentedon Sep 22, 2025
Thanks @lydiabarclay. I requested in ND
quinthar commentedon Oct 12, 2025
Approved $250 to @bernhardoj
quinthar commentedon Oct 18, 2025
Approved $250 to @hoangzinh