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-05-22] Workspace - Unable to search for a member using the number #61752
Version Number: 9.1.43-3 Reproducible in staging?: Yes Reproducible in production?: Unable to check If this was caught during regression testing, add the test name, ID and link from TestRail:#61746 Email or phone of affected tester (no customers): N/A Issue reported by: Applause Internal Team Device used: Windows 11 / Chrome, Android 13 / Xiaomi Poco F5, iOS 15.8.3 / iPhone 7 Plus App Component: Workspace Settings
Action Performed:
Precondition:
Have a workspace with at least 16 members.
At least one member has number as last name
Go to staging.new.expensify.com
Go to workspace settings > Members.
Search for the member with using number
Expected Result:
The number can be used for searching a member.
Typing a random number should have a function and return no result match.
Actual Result:
Unable to search for a member using the number.
Typing any random number also will not have any function.
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
Please re-state the problem that we are trying to solve in this issue.
When searching for workspace members:
If a user types a purely numeric string that does not correspond to any part of a member's display name or email (e.g., a random sequence like "848172361927498127498"), the member list is not filtered, and no "No results found" message is displayed. It should show "No results found."
Users expect to be able to search for members if a number is part of their display name (e.g., searching "123" should find a member named "John 123").
If a member's display name is itself a number (e.g., "777"), searching for that number should find the member.
The core issue is that the search logic needs to correctly handle numeric inputs for all these cases, using both direct string matching for numbers and normalized string matching for diacritics/other characters.
What is the root cause of that problem?
The root cause of the original "full list" bug for non-matching numeric searches is that the searchQuery (e.g., "99999") after being processed by StringUtils.normalize() likely becomes an empty string (""). When this empty string is used in String.prototype.includes(""), it returns true for every member, thus showing the full list.
The extended requirement to search for numbers within names wasn't fully covered by a simple fix for the above, as that fix might have been too restrictive if it only considered cases where the entire normalized name matched an empty normalized query.
The useSearchResults hook provides the filterMember function with an already trimmed and lowercased search query. The filterMember function then needs to intelligently use this query for both direct (number-inclusive) matching and StringUtils.normalize'd matching (for diacritics, etc.), while carefully handling the case where a normalized search query becomes empty.
What changes do you think we should make in order to solve the problem?
We will modify the filterMember function within WorkspaceMembersPage.js.
The approach is two-tiered:
Direct Lowercase Substring Search: First, we'll perform a direct, case-insensitive substring search using the (already trimmed and lowercased) searchQuery from useSearchResults against the lowercased versions of the member's display name (memberOption.text) and alternate text (memberOption.alternateText). If a match is found here (e.g., searching "123" in "John 123"), we return true. This immediately satisfies searching for numbers within names.
Normalized Search (Fallback): If the direct search yields no match (e.g., searching "jose" for a member "José"), we then proceed to a search using StringUtils.normalize on both the member fields and the searchQuery.
The member's display name and alternate text are normalized.
The searchQuery is also normalized.
Crucially, if the searchQuery was non-empty but its normalized version becomes an empty string (e.g., "99999" normalizes to ""), we only consider it a match if the member's normalized text or alternate text is also an empty string. This handles finding members named "777" (if "777" normalizes to "") while correctly filtering out all other members for a query like "99999", thus triggering "No results found."
If the normalized search query is not empty, a standard includes check is performed on the normalized strings. This handles diacritic-insensitive searches like "jose" for "José".
This combined approach ensures numbers are searchable within names, purely numeric names are findable, general search works, and the "full list for random numbers" bug is fixed.
changed the title [-]Workspace - Unable to search for a member using the number[/-][+][Due for payment 2025-05-22] Workspace - Unable to search for a member using the number[/+]on May 15, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.45-21 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@MonilBhavsar@joekaufmanexpensify@MonilBhavsar 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]
Activity
melvin-bot commentedon May 9, 2025
Triggered auto assignment to @MonilBhavsar (
DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.melvin-bot commentedon May 9, 2025
Triggered auto assignment to @joekaufmanexpensify (
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.melvin-bot commentedon May 9, 2025
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon May 9, 2025
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
daledah commentedon May 9, 2025
Coming from #61746
olivierhabi commentedon May 9, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
When searching for workspace members:
The core issue is that the search logic needs to correctly handle numeric inputs for all these cases, using both direct string matching for numbers and normalized string matching for diacritics/other characters.
What is the root cause of that problem?
The root cause of the original "full list" bug for non-matching numeric searches is that the
searchQuery(e.g., "99999") after being processed byStringUtils.normalize()likely becomes an empty string (""). When this empty string is used inString.prototype.includes(""), it returnstruefor every member, thus showing the full list.The extended requirement to search for numbers within names wasn't fully covered by a simple fix for the above, as that fix might have been too restrictive if it only considered cases where the entire normalized name matched an empty normalized query.
The
useSearchResultshook provides thefilterMemberfunction with an already trimmed and lowercased search query. ThefilterMemberfunction then needs to intelligently use this query for both direct (number-inclusive) matching andStringUtils.normalize'd matching (for diacritics, etc.), while carefully handling the case where a normalized search query becomes empty.App/src/pages/workspace/WorkspaceMembersPage.tsx
Lines 495 to 500 in a3446b8
What changes do you think we should make in order to solve the problem?
We will modify the
filterMemberfunction withinWorkspaceMembersPage.js.The approach is two-tiered:
Direct Lowercase Substring Search: First, we'll perform a direct, case-insensitive substring search using the (already trimmed and lowercased)
searchQueryfromuseSearchResultsagainst the lowercased versions of the member's display name (memberOption.text) and alternate text (memberOption.alternateText). If a match is found here (e.g., searching "123" in "John 123"), we returntrue. This immediately satisfies searching for numbers within names.Normalized Search (Fallback): If the direct search yields no match (e.g., searching "jose" for a member "José"), we then proceed to a search using
StringUtils.normalizeon both the member fields and thesearchQuery.searchQueryis also normalized.searchQuerywas non-empty but its normalized version becomes an empty string (e.g., "99999" normalizes to""), we only consider it a match if the member's normalized text or alternate text is also an empty string. This handles finding members named "777" (if "777" normalizes to"") while correctly filtering out all other members for a query like "99999", thus triggering "No results found."includescheck is performed on the normalized strings. This handles diacritic-insensitive searches like "jose" for "José".This combined approach ensures numbers are searchable within names, purely numeric names are findable, general search works, and the "full list for random numbers" bug is fixed.
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
Result
Screen.Recording.2025-05-09.at.08.52.59.mov
4 remaining items
melvin-bot commentedon May 10, 2025
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
If a regression has occurred and you are the assigned CM follow the instructions here.
If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.
MonilBhavsar commentedon May 12, 2025
Issue was fixed. Closing
[-]Workspace - Unable to search for a member using the number[/-][+][Due for payment 2025-05-22] Workspace - Unable to search for a member using the number[/+]melvin-bot commentedon May 15, 2025
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon May 15, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.45-21 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-05-22. 🎊
melvin-bot commentedon May 15, 2025
@MonilBhavsar @joekaufmanexpensify @MonilBhavsar 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]