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 2024-04-09] [$500] Profile page opens with a lag when clicking from a chat #37986

Closed
1 of 6 tasks
m-natarajan opened this issue Mar 8, 2024 · 39 comments
Closed
1 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@m-natarajan
Copy link

m-natarajan commented Mar 8, 2024

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.49-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: @hungvu193
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1709868083089229

Action Performed:

  1. Login with high traffic account
  2. Go to any report that has messages.
  3. Click on user avatar

Expected Result:

Profile page should appear smoothly

Actual Result:

It's a bit laggy when Profile page appears.

Workaround:

unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Screen.Recording.2024-03-08.at.10.21.31.mov
Recording.2831.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0127b4383974c1d34e
  • Upwork Job ID: 1768699308285607936
  • Last Price Increase: 2024-03-15
  • Automatic offers:
    • c3024 | Reviewer | 0
    • tienifr | Contributor | 0
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 8, 2024
Copy link

melvin-bot bot commented Mar 8, 2024

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

@hungvu193
Copy link
Contributor

offending PR as I mentioned earlier in slack: #37223

@melvin-bot melvin-bot bot added the Overdue label Mar 11, 2024
@cubuspl42
Copy link
Contributor

I'm not sure about classifying this as regression... We didn't notice any performance issues when testing #37223. Of course, this can depend on many factors, including the hardware the web app is being tested on.

We haven't added any new logic. Before our PR, the API was still called under some conditions. We just made the conditions less strict. This performance glitch must have been present before; it's just more easily observable now.

@dragnoir
Copy link
Contributor

dragnoir commented Mar 11, 2024

Proposal

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

Profile page lagging when opened.

What is the root cause of that problem?

After the updates from #37223

Every component using withOnyx to key: ONYXKEYS.PERSONAL_DETAILS_LIST will be rendered once we open the profile page and this cause lots of browser memory usage in the background due to lost of images called.

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

On profile page, we need to check if we already have the profile details available, if so, we don't have to call the API.

const profileDetailsAvailable = details.avatar && details.avatarThumbnail && details.displayName && details.login && details.timezone;

useEffect(() => {
        if (ValidationUtils.isValidAccountRoute(accountID) && !profileDetailsAvailable) {
            PersonalDetails.openPublicProfilePage(accountID);
        }
    }, [accountID, profileDetailsAvailable]);

What alternative solutions did you explore? (Optional)

Display a loading indicator as in the avatar modal. If we always need to fetch the API what ever the available details, we can display a loading indicator to give the API the time to turn back the images and to the browser to load it.

@trjExpensify
Copy link
Contributor

We haven't added any new logic. Before our PR, the API was still called under some conditions. We just made the conditions less strict. This performance glitch must have been present before; it's just more easily observable now.

@puneetlath @stitesExpensify as you guys were involved in #36610, do you agree with this assessment or do you think this is a regression from the PR?

@melvin-bot melvin-bot bot removed the Overdue label Mar 11, 2024
@stitesExpensify
Copy link
Contributor

I think that both things are true. The performance issue did exist under some conditions, but that PR has caused it to happen under all conditions. To me that is a regression since this was not happening all of the time before and is happening now.

@cubuspl42
Copy link
Contributor

@kmbcook Could you take a look at this?

@kmbcook
Copy link
Contributor

kmbcook commented Mar 12, 2024

#36610 is unusual in that it requires the API to be called every time an avatar is clicked. Most issues are about improving some aspect of user experience, such as this one. 36610 is different in that it is about implementing a specified method of operation (not about improving a specified aspect of user experience).

It is true that always calling the API does solve some problems, and that there may be other ways to solve those problems. It may be appropriate to create additional issues specific each of those problems and invite proposals.

This issue is not a regression, rather it is a consequence of implementing the method of operation required by the other issue.

@puneetlath
Copy link
Contributor

Question: if you already have the personal details locally for userA. And then you open the profile page of userA which calls the API and returns/merges the same personal details that you already have. Why does anything re-render? Nothing in Onyx or any of the props has actually changed right?

@kmbcook
Copy link
Contributor

kmbcook commented Mar 12, 2024

The personalDetails prop to ProfilePage contains a list of personal details for all users in the high traffic account (a lot of data), not just the personal details of the user whose profile is shown in that page. It might be a good idea to change the page so that it only depends upon the personal details of one user.

@kmbcook
Copy link
Contributor

kmbcook commented Mar 12, 2024

Doesn't Onyx have to do a lot of work to determine that nothing in personalDetails has actually changed (assuming no changes), after the merge to personalDetails which results from the API call? All that work is done on the client. Is that why a lag is observed?

@puneetlath
Copy link
Contributor

Can we use the selector feature of withOnyx to only subscribe to personalDetails updates for the one accountID we're looking at?

@kmbcook
Copy link
Contributor

kmbcook commented Mar 12, 2024

OK, I'd be willing to propose that as a solution to this issue.

@cubuspl42
Copy link
Contributor

@kmbcook No proposal is needed. If you agree that this is a good solution to the uncovered performance problem, implement it and see if you observe the improvement.

If you can easily reproduce the problem in the first place, of course.

@melvin-bot melvin-bot bot added the Overdue label Mar 13, 2024
@kmbcook
Copy link
Contributor

kmbcook commented Mar 13, 2024

I used Chrome performance to measure the time between clicking the avatar and seeing the profile page appear. I only took two or three measurements in each scenario.

Using withOnyx selector actually slowed response time slightly, for some reason.

Using a high-traffic account, and never making the API call, response time is still slow and only slightly faster than always making the API call.

Never making the API call, I see a substantial difference between low-traffic and high-traffic accounts.

The biggest difference is between opening a profile page for the first time and re-opening that same page.

@trjExpensify
Copy link
Contributor

What are the next steps, here? Are we assigning @cubuspl42 and @kmbcook?

@melvin-bot melvin-bot bot removed the Overdue label Mar 14, 2024
Copy link

melvin-bot bot commented Mar 14, 2024

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

@stitesExpensify
Copy link
Contributor

Using a high-traffic account, and never making the API call, response time is still slow and only slightly faster than always making the API call.

This seems like its own problem in and of itself. If we don't make the API call and it's still slow then there must be something wrong on the front end right?

@cubuspl42
Copy link
Contributor

@trjExpensify

I think that it's been decided that the answer is "no".

#36610 (comment)

@trjExpensify
Copy link
Contributor

Got it, so External and Help wanted.

@trjExpensify trjExpensify added the External Added to denote the issue can be worked on by a contributor label Mar 15, 2024
@melvin-bot melvin-bot bot changed the title Profile page opens with a lag when clicking from a chat [$500] Profile page opens with a lag when clicking from a chat Mar 15, 2024
@puneetlath
Copy link
Contributor

Ok got it. @tienifr's suggestion seems pretty good then. What do you think @c3024?

@c3024
Copy link
Contributor

c3024 commented Mar 19, 2024

Yes, @tienifr 's main proposal here looks good to me as well.

@trjExpensify
Copy link
Contributor

Cool, so are we assigning @tienifr then? :)

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 19, 2024
Copy link

melvin-bot bot commented Mar 19, 2024

📣 @c3024 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Mar 19, 2024

📣 @tienifr 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@tienifr
Copy link
Contributor

tienifr commented Mar 21, 2024

PR ready for review #38756.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Apr 2, 2024
@melvin-bot melvin-bot bot changed the title [$500] Profile page opens with a lag when clicking from a chat [HOLD for payment 2024-04-09] [$500] Profile page opens with a lag when clicking from a chat Apr 2, 2024
Copy link

melvin-bot bot commented Apr 2, 2024

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Apr 2, 2024
Copy link

melvin-bot bot commented Apr 2, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.58-8 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 2024-04-09. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Apr 2, 2024

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:

  • [@c3024] The PR that introduced the bug has been identified. Link to the PR:
  • [@c3024] 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:
  • [@c3024] 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:
  • [@c3024] Determine if we should create a regression test for this bug.
  • [@c3024] 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.
  • [@trjExpensify] 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 Apr 8, 2024
@trjExpensify
Copy link
Contributor

👋 Checklist time please, @c3024!

@c3024 c3024 mentioned this issue Apr 11, 2024
57 tasks
@c3024
Copy link
Contributor

c3024 commented Apr 11, 2024

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:

  • [@c3024] The PR that introduced the bug has been identified. Link to the PR: Add new Profile page #20144
  • [@c3024] 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/20144/files#r1560462615
  • [@c3024] 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: This is not a case that can be identified sooner or incorporated in the checklist. So, no discussion has been started.
  • [@c3024] Determine if we should create a regression test for this bug. Yes
  • [@c3024] 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.

Regression test proposal

  1. Logon to ND with a high traffic account
  2. Go to any report with several messages
  3. Press any user avatar in the report
  4. Verify profile page appears seamlessly without any lag
  5. Repeat step 3 for some other avatars and verify that the profile pages appear seamlessly without any lag

👍 or 👎

@melvin-bot melvin-bot bot added the Overdue label Apr 15, 2024
@trjExpensify
Copy link
Contributor

👋 Payment summary as follows:

  • $500 to @c3024 for the C+ review - paid
  • $500 to @tienifr for the fix - paid
  • Bug was reported by @hungvu193, but we don't pay bounties for them anymore.

We have a regression test for testing opening the profile from a user in a conversation, so I think we should be able to catch any noticeable lag or issues with loading that, to the point where we don't need another one.

Thanks ya'll, closing!

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 External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Status: CRITICAL
Development

No branches or pull requests

10 participants