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-01-15] [Due for payment 2026-01-07] [$250] Reports page - The App crashes when switching from withdrawal-id grouping to any other grouping via the dropdown #78278
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorWeeklyKSv2
Version Number: 9.2.85-1 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@JS00001 Slack conversation (hyperlinked to channel name): #expensify_bugs
Action Performed:
Prerequisites: Need using account with a lot of withdrawal-id expenses
Please re-state the problem that we are trying to solve in this issue.
The app crashes when switching the "Group by" filter from "withdrawal-id" to "from" (or any other groupBy value).
What is the root cause of that problem?
The isSearchDataLoaded function in App/src/libs/SearchUIUtils.ts only checks if the type and status match between the search results and the current query. It does not verify that the groupBy parameter also matches.
This causes a race condition:
User changes groupBy from "withdrawal-id" to "from"
The queryJSON is updated with the new groupBy value
The search results still contain old data (grouped by withdrawal-id)
isSearchDataLoaded returns true because it only checks type and status
The component tries to process withdrawal-id grouped data using the "from" groupBy logic
The getMemberSections function expects data with accountID properties
But it receives SearchWithdrawalIDGroup objects with entryID and accountNumber properties instead
This causes a crash when accessing undefined properties
Since the backend doesn't return groupBy, we need to detect it from the data structure:
functiondetectGroupByFromData(data: SearchResults['data']|undefined): SearchGroupBy|null|undefined{if(!data){returnundefined;}lethasAnyData=false;lethasGroupEntries=false;for(constkeyindata){if(key==='personalDetailsList'){continue;}hasAnyData=true;if(isGroupEntry(key)){hasGroupEntries=true;constgroupData=data[key]asSearchMemberGroup|SearchCardGroup|SearchWithdrawalIDGroup;// Check for withdrawal ID group (has entryID and accountNumber)if('entryID'ingroupData&&'accountNumber'ingroupData){returnCONST.SEARCH.GROUP_BY.WITHDRAWAL_ID;}// Check for card group (has cardID)if('cardID'ingroupData){returnCONST.SEARCH.GROUP_BY.CARD;}// Check for member group (has accountID but no cardID or entryID)if('accountID'ingroupData){returnCONST.SEARCH.GROUP_BY.FROM;}}}// If there's data but no group entries, return null (ungrouped search)if(hasAnyData&&!hasGroupEntries){returnnull;}// No data yetreturnundefined;}
functionisSearchDataLoaded(searchResults: SearchResults|undefined,queryJSON: SearchQueryJSON|undefined){const{status, groupBy}=queryJSON??{};constsortedSearchResultStatus=!Array.isArray(searchResults?.search?.status)
? searchResults?.search?.status?.split(',').sort().join(',')
: searchResults?.search?.status?.sort().join(',');constsortedQueryJSONStatus=Array.isArray(status) ? status.sort().join(',') : status;// Basic type and status checkconstbasicMatch=searchResults?.data!==undefined&&searchResults?.search?.type===queryJSON?.type&&sortedSearchResultStatus===sortedQueryJSONStatus;if(!basicMatch){returnfalse;}// Detect the groupBy from the data structure if backend doesn't provide itconstdetectedGroupBy=detectGroupByFromData(searchResults?.data);constdataGroupBy=searchResults?.search?.groupBy??detectedGroupBy;// If we can't detect groupBy (returns undefined), the data is empty// Empty data is safe to display - no crash riskif(detectedGroupBy===undefined){returntrue;}// Verify groupBy matchesconstnormalizedQueryGroupBy=groupBy??null;constnormalizedDataGroupBy=dataGroupBy??null;returnnormalizedDataGroupBy===normalizedQueryGroupBy;}
What alternative solutions did you explore? (Optional)
changed the title [-]Reports page - The App crashes when switching from `withdrawal-id` grouping to any other grouping via the dropdown[/-][+][$250] Reports page - The App crashes when switching from `withdrawal-id` grouping to any other grouping via the dropdown[/+]on Dec 22, 2025
Please re-state the problem that we are trying to solve in this issue.
The app crashes
What is the root cause of that problem?
In getMemberSections and getCardSections, the code accessed data.personalDetailsList[accountID] without checking if personalDetailsList exists. When switching groupBy, personalDetailsList can be undefined, causing a crash.
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
Thanks for the proposals I think @daledah's proposal is correct. Since personalDetailsList is can be undefinedbut the current type doesn't allow it, so i think we should update the personalDetailsListtype to support undefined as well. This will help catch the crash earlier.
changed the title [-][Due for payment 2026-01-07] [$250] Reports page - The App crashes when switching from `withdrawal-id` grouping to any other grouping via the dropdown[/-][+][Due for payment 2026-01-15] [Due for payment 2026-01-07] [$250] Reports page - The App crashes when switching from `withdrawal-id` grouping to any other grouping via the dropdown[/+]on Jan 8, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.95-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@linhvovan29546@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] 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:
[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.ExternalAdded to denote the issue can be worked on by a contributorWeeklyKSv2
Activity
melvin-bot commentedon Dec 22, 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.abbasifaizan70 commentedon Dec 22, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
The app crashes when switching the "Group by" filter from "withdrawal-id" to "from" (or any other groupBy value).
What is the root cause of that problem?
The
isSearchDataLoadedfunction inApp/src/libs/SearchUIUtils.tsonly checks if thetypeandstatusmatch between the search results and the current query. It does not verify that thegroupByparameter also matches.This causes a race condition:
isSearchDataLoadedreturnstruebecause it only checks type and statusgetMemberSectionsfunction expects data withaccountIDpropertiesSearchWithdrawalIDGroupobjects withentryIDandaccountNumberproperties insteadCurrent code:
https://github.com/Expensify/App/blob/main/src/libs/SearchUIUtils.ts#L2884-L2895
What changes do you think we should make in order to solve the problem?
1. Add
groupByproperty toSearchResultsInfotypehttps://github.com/Expensify/App/blob/main/src/types/onyx/SearchResults.ts#L39-L70
2. Create helper function to detect groupBy from data structure
https://github.com/Expensify/App/blob/main/src/libs/SearchUIUtils.ts#L2884
Since the backend doesn't return
groupBy, we need to detect it from the data structure:3. Update
isSearchDataLoadedfunctionhttps://github.com/Expensify/App/blob/main/src/libs/SearchUIUtils.ts#L2917
What alternative solutions did you explore? (Optional)
None
Demo
[-]Reports page - The App crashes when switching from `withdrawal-id` grouping to any other grouping via the dropdown[/-][+][$250] Reports page - The App crashes when switching from `withdrawal-id` grouping to any other grouping via the dropdown[/+]melvin-bot commentedon Dec 22, 2025
Job added to Upwork: https://www.upwork.com/jobs/~022003109092606784237
melvin-bot commentedon Dec 22, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @linhvovan29546 (
External)daledah commentedon Dec 22, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
The app crashes
What is the root cause of that problem?
In
getMemberSectionsandgetCardSections, the code accesseddata.personalDetailsList[accountID]without checking ifpersonalDetailsListexists. When switchinggroupBy,personalDetailsListcan beundefined, causing a crash.App/src/libs/SearchUIUtils.ts
Lines 1912 to 1913 in 5685a5f
App/src/libs/SearchUIUtils.ts
Lines 1871 to 1872 in 5685a5f
What changes do you think we should make in order to solve the problem?
We should add optional chaining and a fallback to
emptyPersonalDetailsin both functions like we did with other functions here, here, ...App/src/libs/SearchUIUtils.ts
Lines 1871 to 1872 in 5685a5f
App/src/libs/SearchUIUtils.ts
Lines 1912 to 1913 in 5685a5f
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
linhvovan29546 commentedon Dec 23, 2025
Thanks for the proposals I think @daledah's proposal is correct. Since
personalDetailsListis can beundefinedbut the current type doesn't allow it, so i think we should update thepersonalDetailsListtype to supportundefinedas well. This will help catch the crash earlier.App/src/types/onyx/SearchResults.ts
Line 301 in ff71123
Record<typeof ONYXKEYS.PERSONAL_DETAILS_LIST, Record<string, PersonalDetails> | undefined> &🎀 👀 🎀 C+ reviewed
28 remaining items
daledah commentedon Jan 6, 2026
@linhvovan29546 we have the follow up PR here
[-][Due for payment 2026-01-07] [$250] Reports page - The App crashes when switching from `withdrawal-id` grouping to any other grouping via the dropdown[/-][+][Due for payment 2026-01-15] [Due for payment 2026-01-07] [$250] Reports page - The App crashes when switching from `withdrawal-id` grouping to any other grouping via the dropdown[/+]melvin-bot commentedon Jan 8, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Jan 8, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.95-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 2026-01-15. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Jan 8, 2026
@linhvovan29546 @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]
linhvovan29546 commentedon Jan 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: https://github.com/Expensify/App/pull/67802/changes#r2690428215
[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:
[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/589088
Regression Test Proposal
Precondition:
withdrawal-idexpensesTest:
type:expense group-by:withdrawal-idwithdrawal-idtoFromorCard> ApplyDo we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-56a7-a53f-a203-24190c175814sonialiap commentedon Jan 15, 2026
Payment summary:
@linhvovan29546 $250 paid in upwork
@daledah $250 paid in upwork