Skip to content
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

[HOLD for payment 2023-07-17] [$1000] In the Assign Task flow, when typing an assignee’s email, there is massive lag #20075

Closed
1 of 6 tasks
kavimuru opened this issue Jun 2, 2023 · 69 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Internal Requires API changes or must be handled by Expensify staff

Comments

@kavimuru
Copy link

kavimuru commented Jun 2, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. In NewDot, press the green + button
  2. Click Assign Task
  3. Enter a title and click next
  4. Click “Assignee”
  5. Start typing a name or email
  6. There is massive lag

Expected result:

When I enter a name or email in the Assignee screen, the name/email I type should appear in realtime as I type

Actual result:

The letters lag several seconds after I type them in the Assignee screen.

NOTE: There's about a 4 second lag. Seems like a scaling issue. Account with policy admin on hundreds of policies, and huge members list

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number:
Reproducible in staging?: needs reproduction
Reproducible in production?: needs reproduction
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
Notes/Photos/Videos: Any additional supporting documentation

Expensify/Expensify Issue URL:
Issue reported by: @sakluger
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1684539726401459

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01cbd41563f4009996
  • Upwork Job ID: 1666211042283540480
  • Last Price Increase: 2023-06-27
@kavimuru kavimuru added Daily KSv2 Needs Reproduction Reproducible steps needed Bug Something is broken. Auto assigns a BugZero manager. labels Jun 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 2, 2023

Triggered auto assignment to @sonialiap (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Jun 2, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot melvin-bot bot added the Overdue label Jun 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 5, 2023

@sonialiap Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@sonialiap
Copy link
Contributor

sonialiap commented Jun 6, 2023

Reproducible

For me clicking on Assignee, clicking into the text field, trying to type, all of it is super laggy

@melvin-bot melvin-bot bot removed the Overdue label Jun 6, 2023
@sonialiap sonialiap added External Added to denote the issue can be worked on by a contributor and removed Needs Reproduction Reproducible steps needed labels Jun 6, 2023
@melvin-bot melvin-bot bot changed the title In the Assign Task flow, when typing an assignee’s email, there is massive lag [$1000] In the Assign Task flow, when typing an assignee’s email, there is massive lag Jun 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 6, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01cbd41563f4009996

@melvin-bot
Copy link

melvin-bot bot commented Jun 6, 2023

Current assignee @sonialiap is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jun 6, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @rushatgabhane (External)

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 6, 2023

Triggered auto assignment to @francoisl (External), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@Thanos30
Copy link
Contributor

Thanos30 commented Jun 9, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Text Input lags when opening Assignee section on Task creation.

What is the root cause of that problem?

The root cause of the issue lies on TaskAssigneeSelectorModal.js file, and specifically on the updateOptions function.

The updateOptions function is being called on onChangeText callback of the TextInput, and it is also being called on the second useEffect hook we have. This makes it re-render more than needed times, which causes the lag we face.

What changes do you think we should make in order to solve the problem?

Calling the updateOptions() function on the onChangeText callback is not necessary, because this will trigger the second useEffect Hook anyway, since the searchTerm is on the updateOptions dependency array. So we can remove it from there. Removing it solves the problem almost completely.

Additionally, while not a big fan of the setTimeout function, in this case it is essential to use it, to make sure we don't overflow the component with updateOptions() an unnecessary amount of times while the user types.

The onChangeText will look like this:

const onChangeText = (newSearchTerm = '') => {
        setSearchValue(newSearchTerm);
    };

The second useEffect hook on TaskAssigneeSelectorModal.js file will look like this:

useEffect(() => {
        Timing.start(CONST.TIMING.SEARCH_RENDER);
        Performance.markStart(CONST.TIMING.SEARCH_RENDER);

        const debounceTimer = setTimeout(updateOptions, 300);

        return () => {
            clearTimeout(debounceTimer);
            Timing.end(CONST.TIMING.SEARCH_RENDER);
            Performance.markEnd(CONST.TIMING.SEARCH_RENDER);
        };
    }, [updateOptions]);

, where we set a debounceTimer for the call which we clear on return.

This makes the component much smoother to use.

Video:

Screen.Recording.2023-06-09.at.4.32.58.PM.mov

@melvin-bot melvin-bot bot added the Overdue label Jun 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 12, 2023

@francoisl, @sonialiap, @rushatgabhane Huh... This is 4 days overdue. Who can take care of this?

@melvin-bot
Copy link

melvin-bot bot commented Jun 13, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@francoisl
Copy link
Contributor

Cool, thanks for the proposal @Thanos30. Removing the duplicate call to updateOptions() makes sense to me.

I'm less convinced about the setTimeout, do you still notice a performance issue without it? Also, is it easier than using _.debounce() in this situation?

@melvin-bot melvin-bot bot removed the Overdue label Jun 13, 2023
@Thanos30
Copy link
Contributor

Thanos30 commented Jun 13, 2023

@francoisl We can still work with only removing the duplicate call to updateOptions(), I just thought there is no need to trigger the search with every user type. We could possibly use the _.debounce() method too, it's up to you wether you would like to implement a debounce search here or not, both will have the same outcome.

@francoisl
Copy link
Contributor

I think we tend to prefer _.debounce() over setTimeout() in situations like this, but _.debounce also uses setTimeout under the hood, so I don't know if there's an advantage to using one over the other.

I'll test tomorrow on a workspace that has a large number of members, to see if there's a performance advantage to using setTimeOut/_.debounce.

In the meantime, @rushatgabhane do you have an opinion on this one?

@francoisl
Copy link
Contributor

francoisl commented Jun 15, 2023

Ok, I ran more tests on a local domain with ~7500 accounts.

  • On main:
lag_issue_main.mov
  • Just removing the call to updateOptions() from onChangeText. It feels better typing keys individually, but the lag is still visible if you smash a lot of keys very quickly
lag_issue_option1.mov
  • With a setTimeout() and the delay set to 100 (300 feels too long), in addition to removing the extra call to updateOptions(). This one feels the smoothest IMO
lag_issue_option2.mov

Overall I think using the combination of the timeout and removing the extra updateOptions() might be the best improvement, what do you think @rushatgabhane?

@Thanos30
Copy link
Contributor

Thanos30 commented Jun 15, 2023

Did you try a combination of the 2? It smooths it out completely for me, and the updateOptions call on change text callback is not needed, it's an extra re-render for no reason

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Jul 10, 2023
@melvin-bot melvin-bot bot changed the title [$1000] In the Assign Task flow, when typing an assignee’s email, there is massive lag [HOLD for payment 2023-07-17] [$1000] In the Assign Task flow, when typing an assignee’s email, there is massive lag Jul 10, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 10, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 10, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot
Copy link

melvin-bot bot commented Jul 10, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.38-7 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 2023-07-17. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Jul 10, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@rushatgabhane] The PR that introduced the bug has been identified. Link to the PR:
  • [@rushatgabhane] 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:
  • [@rushatgabhane] A discussion in #expensify-bugs 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:
  • [@rushatgabhane] Determine if we should create a regression test for this bug.
  • [@rushatgabhane] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@sonialiap] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jul 17, 2023
@Thanos30
Copy link
Contributor

@francoisl HOLD for payment was on 2023-07-17. Bumping to make sure everything is okay

@francoisl
Copy link
Contributor

Thanks for the reminder. I didn't see or hear about any issues with this, so let's go ahead with payments @sonialiap please.

@Thanos30
Copy link
Contributor

Thank you @francoisl 🙏 Also, you probably missed it before, should I make an offer on the job after all? I didn't see the auto-assingment.

@francoisl
Copy link
Contributor

Yes I think you'll need to, though I don't have access to Upwork myself to verify. @sonialiap can you assist please?

@sonialiap
Copy link
Contributor

Sorry about the delay! I missed that the issue's title changed to "payment". Working on this now!

@sonialiap
Copy link
Contributor

sonialiap commented Jul 21, 2023

@Thanos30 offer sent for fix (+bonus) - paid ✔️
@rushatgabhane to be paid via NewDot (+bonus)

@Thanos30
Copy link
Contributor

@sonialiap Thank you! Offer accepted

@sonialiap
Copy link
Contributor

@rushatgabhane when you get a chance could you please work through the checklist

@rushatgabhane
Copy link
Member

rushatgabhane commented Jul 23, 2023

  1. The PR that introduced the bug has been identified. Link to the PR: Create Task FrontEnd Changes #17992

  2. 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/17992/files#r1271456240

  3. A discussion in #expensify-bugs 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: https://expensify.slack.com/archives/C01GTK53T8Q/p1690122436052539

  4. Determine if we should create a regression test for this bug. No. It won't happen again for these pages

  5. If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again No

@rushatgabhane
Copy link
Member

Made a manual request on new dot https://staging.new.expensify.com/r/5352934870483260

@melvin-bot melvin-bot bot added the Overdue label Jul 25, 2023
@sonialiap
Copy link
Contributor

I believe we can close this, feel free to reopen if you need to.

@JmillsExpensify
Copy link

@sonialiap Can you please summarize the appropriate individual payments for all parties involved in this issue? This is holding up @rushatgabhane's NewDot payments. More information on this compliance process in Slack.

@sonialiap
Copy link
Contributor

Issue reporter: none
Contributor: @Thanos30 $1500
Contributor+: @rushatgabhane $1500

@JmillsExpensify
Copy link

Reviewed details for @rushatgabhane. These details are accurate based on summary from Business Reviewer and are now approved for payment in NewDot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Internal Requires API changes or must be handled by Expensify staff
Projects
None yet
Development

No branches or pull requests

6 participants