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
[$500] iOS - Request Money - Searching for specific HT account while using HT account has an odd behavior #30803
Version Number: 1.3.95.0 Reproducible in staging?: y Reproducible in production?: y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: Applause - Internal Team Slack conversation:
changed the title [-]iOS - Request Money - Searching for specific HT account while using HT account has an odd behavior[/-][+][$500] iOS - Request Money - Searching for specific HT account while using HT account has an odd behavior[/+]on Nov 2, 2023
Please re-state the problem that we are trying to solve in this issue.
The account being searched is at the top of the list, but then reappears at the bottom constantly changing avatars.
What is the root cause of that problem?
It shows an existing account with a specific existing email and it also adds a non-existed account with non-existed email.
When we are searching with some text, search input sends a search term for every single character. In every request, it will call this method, this method returns all list options:
Existed user:
If the email address is valid, it will be added into sections: applausetester+vd_htmain@applause.e is enough, not required to be whole email, just valid, existed email pattern is enough
That's why the avatar is changing because, for every valid email, for every single character, it will send a request, in every request, the non-exist user(all different user) will be added into sections, in this example, for all characters in this text [xpensifail.co]. The email was so long, so we didn't see it was changing in the row.
What changes do you think we should make in order to solve the problem?
We need to improve UX. We can make some changes to the email address, maybe we can concat from the middle, or concat from the head, now it is concating from the tail.
Concating from head:
Concating from middle:
We can make other UX design changes, user can easily understand what is going on.
What alternative solutions did you explore? (Optional)
Or we can set a limit on email length, so it can't be that long to be out of the screen. In example, 42 character length email:
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.
Please re-state the problem that we are trying to solve in this issue.
In request money participants selector page, the search results keeps getting constantly updated (i.e avatar, search result itself) even after the user has stopped entering the search value. This is the problem we are trying to solve here.
What is the root cause of that problem?
When a long search text is entered (e.g. applausetester+vd_htmain@applause.expensifail.com), this will generate many API requests to the server for reports as shown here. Since each of these responses will come back at some time later and trigger the useEffecthere, updation of the sectionshere will get delayed in a HT environment with lots of results.
What changes do you think we should make in order to solve the problem?
We can solve this problem by debouncing the updation of chat options thereby saving processing time which will matter a lot in a HT environment.
We can move the contents of useEffecthere into a new function updateChatOptions like this
I tested on latest main and the behavior is not that odd. @rojiphil can you please retest and share video?
FYI: debounce was introduced in #32962 and just deployed to staging
I'm going to go ahead and close this issue based on @situchan's experience. @rojiphil feel free to let us know if you think otherwise and we can reopen if there is something to fix.
Activity
[-]iOS - Request Money - Searching for specific HT account while using HT account has an odd behavior[/-][+][$500] iOS - Request Money - Searching for specific HT account while using HT account has an odd behavior[/+]melvin-bot commentedon Nov 2, 2023
Job added to Upwork: https://www.upwork.com/jobs/~01c1e5f3f5dad45859
melvin-bot commentedon Nov 2, 2023
Triggered auto assignment to @puneetlath (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Nov 2, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)melvin-bot commentedon Nov 2, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav (
External)orshikh-dev commentedon Nov 3, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
The account being searched is at the top of the list, but then reappears at the bottom constantly changing avatars.
What is the root cause of that problem?
It shows an existing account with a specific existing email and it also adds a non-existed account with non-existed email.
When we are searching with some text, search input sends a search term for every single character. In every request, it will call this method, this method returns all list options:
App/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js
Lines 111 to 160 in a61572e
If we find a user with a specific email, that user will be added to sections
App/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js
Lines 115 to 124 in a61572e
And if a user does not exist, we add non-existing users into sections as well,
App/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js
Lines 147 to 159 in a61572e
There are 2 possible cases:
CASE 1: THE USER DOES NOT EXIST
Non-existing user is added into sections, no issues:
App/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js
Lines 147 to 159 in a61572e
CASE 2: USER EXIST
In this case, the user will be added to the section, just like this:
App/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js
Line 124 in a61572e
But, in every single valid email address, it will be a non-existent user:
For example applausetester+vd_htmain@applause.expensifail.com
Existed user:
If the email address is valid, it will be added into sections:
applausetester+vd_htmain@applause.e is enough, not required to be whole email, just valid, existed email pattern is enough
Non-existed users with valid emails:
applausetester+vd_htmain@applause.e <= here we know this email is valid and found existed user with this email
applausetester+vd_htmain@applause.ex
applausetester+vd_htmain@applause.exp
applausetester+vd_htmain@applause.expe
applausetester+vd_htmain@applause.expen
. . .
applausetester+vd_htmain@applause.expensifail.co <= till, not whole email address
That's why the avatar is changing because, for every valid email, for every single character, it will send a request, in every request, the non-exist user(all different user) will be added into sections, in this example, for all characters in this text [xpensifail.co]. The email was so long, so we didn't see it was changing in the row.
Please see from this video:
https://drive.google.com/file/d/1LOnmzTz-fSW9oCk-p55pkh0PlKRmRBv0/view?usp=sharing
What changes do you think we should make in order to solve the problem?
Concating from head:

Concating from middle:

What alternative solutions did you explore? (Optional)
Or we can set a limit on email length, so it can't be that long to be out of the screen. In example, 42 character length email:

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.
rojiphil commentedon Nov 3, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
In request money participants selector page, the search results keeps getting constantly updated (i.e avatar, search result itself) even after the user has stopped entering the search value. This is the problem we are trying to solve here.
What is the root cause of that problem?
When a long search text is entered (e.g. applausetester+vd_htmain@applause.expensifail.com), this will generate many API requests to the server for reports as shown here. Since each of these responses will come back at some time later and trigger the
useEffecthere, updation of thesectionshere will get delayed in a HT environment with lots of results.What changes do you think we should make in order to solve the problem?
We can solve this problem by debouncing the updation of chat options thereby saving processing time which will matter a lot in a HT environment.
useEffecthere into a new functionupdateChatOptionslike thisupdateChatOptionscan be done like this hereWhat alternative solutions did you explore? (Optional)
melvin-bot commentedon Nov 6, 2023
@puneetlath, @mananjadhav Whoops! This issue is 2 days overdue. Let's get this updated quick!
42 remaining items
melvin-bot commentedon Dec 12, 2023
@puneetlath, @situchan Eep! 4 days overdue now. Issues have feelings too...
situchan commentedon Dec 12, 2023
Reviewed all conversations. reviewing proposals.
puneetlath commentedon Dec 15, 2023
Let us know your thoughts @situchan
situchan commentedon Dec 19, 2023
I tested on latest main and the behavior is not that odd.
@rojiphil can you please retest and share video?
FYI: debounce was introduced in #32962 and just deployed to staging
melvin-bot commentedon Dec 22, 2023
@puneetlath, @situchan Whoops! This issue is 2 days overdue. Let's get this updated quick!
puneetlath commentedon Dec 22, 2023
I'm going to go ahead and close this issue based on @situchan's experience. @rojiphil feel free to let us know if you think otherwise and we can reopen if there is something to fix.