-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[$500] Search - Delayed Removal of Loader When Removing a Character from the Search Field #31800
Comments
Job added to Upwork: https://www.upwork.com/jobs/~0141bb6ce1d327d478 |
Triggered auto assignment to @JmillsExpensify ( |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to Contributor-plus team member for initial proposal review - @jjcoffee ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Search - Delayed Removal of Loader When Removing a Character from the Search Field What is the root cause of that problem?Normally, whenever there is a change of Lines 86 to 92 in 4952c39
we are not calling Report.searchInServer but we are not resetting IS_SEARCHING_FOR_REPORTS so it will only reset when the last query to the server resolves, hence the lag to remove the loader occurs.
What changes do you think we should make in order to solve the problem?We should set the Lines 86 to 92 in 4952c39
to
What alternative solutions did you explore? (Optional) |
ProposalPlease re-state the problem that we are trying to solve in this issue.Search - Delayed Removal of Loader When Removing a Character from the Search Field What is the root cause of that problem?When we change the input we make a request to the server and show the loader using App/src/libs/actions/Report.js Lines 2501 to 2502 in f52c59d
What changes do you think we should make in order to solve the problem?Since we will in any case disable the loader after the server responds and it makes no sense to forcefully change the value in ONYX, in my opinion, it is best not to show the loader when we have an empty input So we can update this line like
Line 212 in 7a68a3d
Also I noticed the same problem on What alternative solutions did you explore? (Optional)Also, we can add a new prop for Plus I don’t like why when we hover over the loader we see a pointer cursor |
ProposalPlease re-state the problem that we are trying to solve in this issue.Search - Delayed Removal of Loader When Removing a Character from the Search Field What is the root cause of that problem?When we update search input, we will set IS_SEARCHING_FOR_REPORTS is true in optimistic data and reset it to false in successData and failureData. So even though we clear input, IS_SEARCHING_FOR_REPORTS is only set to false when API is done. What changes do you think we should make in order to solve the problem?This problem happen in NewChatPage, SearchPage, MoneyRequestParticipantsSelector, TaskShareDestinationSelectorModal,... What alternative solutions did you explore? (Optional) |
ProposalPlease re-state the problem that we are trying to solve in this issue.When quickly typing and removing a character in search, the spinner is still loading. What is the root cause of that problem?We show the spinner when What changes do you think we should make in order to solve the problem?First of all, it's worth noticing that such a behavior happens in all the pages where we currently use if (text.length) {
Report.searchInServer(text);
} To fix this behavior, we should update
if (isNetworkOffline || !searchInput.trim().length) {
Onyx.set(ONYXKEYS.IS_SEARCHING_FOR_REPORTS, false);
return;
} App/src/libs/actions/Report.js Lines 2496 to 2507 in 39d2d98
We should also remove all the ResultScreen.Recording.2023-11-24.at.09.55.16.movWhat alternative solutions did you explore? (Optional) |
ProposalPlease re-state the problem that we are trying to solve in this issue.The issue at hand (Search - Delayed Removal of Loader When Removing a Character from the Search Field #31800) involves the delayed removal of a loader when search input emptied from the search field. What is the root cause of that problem?The root cause of the problem lies in the asynchronous nature of the API call triggered by the onChangeText function. When the user quickly emptied the input before the API call completes, the loader is not dismissed as expected.
What changes do you think we should make in order to solve the problem?The quick workaround involves updating the
We also need to eliminate the string length/empty checks from the calls to the Report.searchInServer method.
This solution improves code readability and maintainability. What alternative solutions did you explore? (Optional)An alternative solution is proposed to optimize the process further by maintaining a hashmap of already searched terms. This avoids unnecessary API calls when the user repeats a search term, enhancing performance.
This alternative solution minimizes API calls by checking if the search term has been used before, providing a more efficient search mechanism. The hashmap is reset on page load to ensure the latest data is considered. Note: This approach introduces a caching mechanism. A potential drawback of caching is that it may not always provide the most up-to-date data during the search period. However, if immediate data updates are crucial, then additional API call should also be triggered when the search input is empty to fetch the latest information. |
📣 @faisal-ibrahim! 📣
|
Contributor details |
✅ Contributor details stored successfully. Thank you for contributing to Expensify! |
@jjcoffee thoughts on the proposals so far? |
Thanks for the proposals everyone! All of the proposed solutions here are workable, but I personally prefer @paultsimura's proposal as it makes the code more DRY by moving the repeated uses of 🎀👀🎀 C+ reviewed |
Triggered auto assignment to @Gonals, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
@jjcoffee The meaning of IS_SEARCHING_FOR_REPORTS field is checking whether if search API is executing or not. So I see that @paultsimura's proposal will make the meaning of this field become wrong and confusing. We shouldn't reset ONYXKEYS.IS_SEARCHING_FOR_REPORTS to false while the search API is executing. cc @Gonals |
Agree |
@DylanDylann I appreciate your point, however once we clear the input (or have empty spaces), the originally initiated |
It's up to our expected. I think |
Working through proposals |
Just waiting on @Gonals to assign @paultsimura per this comment. |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
📣 @jjcoffee 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app! |
📣 @paultsimura 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
Thanks. The PR is ready for review: #32371 |
The PR was deployed to prod, but the automation did not trigger: #32371 (comment). Is this a false alert or a broken automation? cc: @Gonals |
Had the same on a couple other issues on the same deploy so there must have been something up with the automation! @JmillsExpensify Could you add the |
@JmillsExpensify a friendly bump, please:
|
Payment summary:
|
No comments on the above, so I'm going to issue payments now. |
All contributors paid, though @jjcoffee would you mind completing the BZ checklist first so we can close this out? |
Regression Test Proposal
Do we agree 👍 or 👎 |
@JmillsExpensify Thanks for processing the payment, and apologies for missing the checklist. Done now! |
Thank you! All looks good. I'll get that regression test added. |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 1.4.2-3
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:
Action Performed:
Expected Result:
When removing a character, the loader should be promptly removed with it because the data is already loaded
Actual Result:
After removing the character, the loader is eventually removed, but there is a noticeable delay of 3 to 4 seconds before it disappears, creating the impression that data is still loading/searching
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6288586_1700749110780.2023-11-23_18-55-42.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: