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-11-13] [$250] Search - Some expenses are unselected after sorting #70594
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.2.14-1 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail:#70211 Email or phone of affected tester (no customers):ndk.2303+new101@gmail.com Issue reported by: Applause - Internal Team
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
NA
What alternative solutions did you explore? (Optional)
Or we can fix the root cause by modifying the critical useEffect that rebuilds the selection state when data changes.
This useEffect currently uses the unsorted data array to determine which transactions should be selected, but it should use the same sorted data that's displayed to the user.
By making this useEffect use getSortedSections() instead of raw data, we ensure that the selection state is always built from the same data source that users actually see
When sorting changes, the hash changes, triggering clearTransactionsAndSetHashAndKey in the useFocusEffect which clears the selection because the new hash doesn't match the stored currentSearchHash
Then update the SearchQueryJSON type to include the new sortingHash
typeSearchQueryJSON={inputQuery: SearchQueryString;hash: number;/** Hash used for putting queries in recent searches list. It ignores sortOrder and sortBy, because we want to treat queries differing only in sort params as the same query */recentSearchHash: number;/** Use similarSearchHash to test if two searchers are similar i.e. have same filters but not necessary same values */similarSearchHash: number;sortingHash: number;flatFilters: QueryFilters;}&SearchQueryAST;
/** Hash used for putting queries in recent searches list. It ignores sortOrder and sortBy, because we want to treat queries differing only in sort params as the same query */
recentSearchHash: number;
/** Use similarSearchHash to test if two searchers are similar i.e. have same filters but not necessary same values */
changed the title [-]Search - Some expenses are unselected after sorting[/-][+][$250] Search - Some expenses are unselected after sorting[/+]on Sep 23, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.45-6 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@eVoloshchak / @abzokhattab@sonialiap 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]
[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: no offending PR, we ended up changing the expected behavior to "unselect all when filters are changed"
[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: regression wasn't critical
[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.
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 Sep 15, 2025
Triggered auto assignment to @sonialiap (
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.abzokhattab commentedon Sep 15, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Some expenses become unselected after sorting in the Reports tab when "Select All" is used.
What is the root cause of that problem?
dataarray to determine which transactions to selectgetSortedSections()but the selection logic still references the original unsorted datakeyForList) and the actual displayed data orderWhat changes do you think we should make in order to solve the problem?
dataarraygetSortedSections()to get the same data that's actually being displayed to the userfinal function:
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
NA
What alternative solutions did you explore? (Optional)
getSortedSections()instead of raw data, we ensure that the selection state is always built from the same data source that users actually seenyomanjyotisa commentedon Sep 16, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Search - Some expenses are unselected after sorting
What is the root cause of that problem?
The current hash calculation
getQueryHashesincludessortByandsortOrderparameters in the primary hash calculationApp/src/libs/SearchQueryUtils.ts
Lines 337 to 338 in ae3b077
When sorting changes, the hash changes, triggering
clearTransactionsAndSetHashAndKeyin theuseFocusEffectwhich clears the selection because the new hash doesn't match the storedcurrentSearchHashApp/src/components/Search/index.tsx
Line 322 in ae3b077
What changes do you think we should make in order to solve the problem?
We can change the hash calculation to exclude sorting parameters from the primary hash used for selection state management
App/src/libs/SearchQueryUtils.ts
Lines 298 to 345 in ae3b077
Then update the
SearchQueryJSONtype to include the newsortingHashApp/src/components/Search/types.ts
Lines 180 to 188 in ae3b077
And add it to the result on
buildSearchQueryJSONApp/src/libs/SearchQueryUtils.ts
Lines 389 to 394 in ae3b077
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
None
What alternative solutions did you explore? (Optional)
None
melvin-bot commentedon Sep 22, 2025
@sonialiap Still overdue 6 days?! Let's take care of this!
[-]Search - Some expenses are unselected after sorting[/-][+][$250] Search - Some expenses are unselected after sorting[/+]melvin-bot commentedon Sep 23, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021970452751423896945
melvin-bot commentedon Sep 23, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eVoloshchak (
External)36 remaining items
melvin-bot commentedon Nov 6, 2025
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Nov 6, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.45-6 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-11-13. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Nov 6, 2025
@eVoloshchak / @abzokhattab @sonialiap 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]
sonialiap commentedon Nov 13, 2025
Payment summary:
@eVoloshchak $250 please request in NewDot and complete the checklist
@abzokhattab $250 paid in upwork ✔️
sonialiap commentedon Nov 24, 2025
@eVoloshchak bump on completing the checklist
eVoloshchak commentedon Nov 24, 2025
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: no offending PR, we ended up changing the expected behavior to "unselect all when filters are changed"
[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: regression wasn't critical
[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/571717
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
sonialiap commentedon Nov 25, 2025
Thanks!
garrettmknight commentedon Dec 1, 2025
$250 approved for @eVoloshchak