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-10-02] [$1000] Web - Group user avatar icons re-arrange #23364

Closed
1 of 6 tasks
kbecciv opened this issue Jul 21, 2023 · 63 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 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@kbecciv
Copy link

kbecciv commented Jul 21, 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. Go to make a new group
  2. Select a few group members
  3. The new group gets created
  4. Profile avatar of users gets re-arranged after few seconds

Expected Result:

Group members avatars should not re-arrange or flicker

Actual Result:

Group members avatars re-arranging

Workaround:

Unknown

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: 1.3.43-6
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
Notes/Photos/Videos: Any additional supporting documentation

Screen.Recording.2023-07-20.at.4.32.41.PM.mov
Recording.3819.mp4

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~014473a252a569df0c
  • Upwork Job ID: 1684209321111580672
  • Last Price Increase: 2023-07-26
  • Automatic offers:
    • honnamkuan | Contributor | 26162998
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 21, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 21, 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

@ojasjadhav2
Copy link
Contributor

ojasjadhav2 commented Jul 22, 2023

Proposal

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

Group user avatar icons are re-arranging after a few seconds

What is the root cause of that problem?

Initially, when a group is created the order/arrangement of Icons is in the same order as the user has selected the members in.
The reason being, the Icons are stored in State in this initial order only.
But, when the API returns a response, this order/arrangement is updated to whatever comes in API response.

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

here icons is fetched using State data, and later using API response data

}
const icons = ReportUtils.getIcons(props.report, props.personalDetails);

We can store the icons in a useMemo with an empty dependency array.
This will store the initial arrangement of icons which was fetched using State data in the cache, and when API response data hits, no update/re-arrangement will happen.

This will ensure that the icons remains in same order as selected by the user.
However, it will be shown in API response's order once we refresh the page, which is totally fine behaviour.

What alternative solutions did you explore? (Optional)

Can Re-arrange sortedParticipantDetails according to first name, etc. need to know what exact criteria for sorting is being followed in backend.

@melvin-bot
Copy link

melvin-bot bot commented Jul 22, 2023

📣 @ojasjadhav2! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@honnamkuan
Copy link
Contributor

honnamkuan commented Jul 22, 2023

Proposal

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

On creating a new group, the user avatars ordering is re-arranged after a few seconds

What is the root cause of that problem?

There is an existing implementation to sort the user logins for avatars by first name

App/src/libs/ReportUtils.js

Lines 767 to 768 in e87ba56

// Sort all logins by first name (which is the second element in the array)
const sortedParticipantDetails = participantDetails.sort((a, b) => a[2] - b[2]);

However, the implementation is wrong as both a[2] and b[2] are string, so minus one with another would results in NaN, the end result is that the array is actually not sorted at all.

The reason it get re-arranged after a few second is due to the report participant list returned by OpenReport API is in different order compared to the optimisticChatReport with unsorted user list constructed in

newChat = ReportUtils.buildOptimisticChatReport(participantAccountIDs);

but that is not a problem at all, as long as the icons sorting in ReportUtils#getIconsForParticipants is fixed to work properly.

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

We need to fix the implementation to use underscore sortBy, and implement additional sub-sorting to ensure icons stay sorted in consistent manner even when we have multiple participants with the exact same first name.

The sorting logic to implement would be depending on requirements, but I would propose something like the following:
sort by first name, then sub-sort by login/displayName, then sub-sort with accountID

e.g.

    // Sort all logins by first name (position 2 element in array)
    // if multiple participants have the same first name, sub-sort them by login/displayName (position 1 element in array)
    // if that still clashes, sub-sort by accountID (position 0 element in array)
    const sortedParticipantDetails = _.chain(participantDetails)
        .sortBy((detail) => detail[0])
        .sortBy((detail) => detail[1])
        .sortBy((detail) => detail[2])
        .value();

That will ensure the avatar get sorted by the users first name correctly, and if first name is not available and defaults to empty '' (e.g. when adding multiple new users without prior interaction to new group), there is a sub-sort using login/displayName and accountID to ensure the avatars position stay consistent and do not flickers.

What alternative solutions did you explore? (Optional)

N/A

@ojasjadhav2
Copy link
Contributor

Contributor details
Your Expensify account email: ojasjadhav456@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01cafdb2439c9ee36f

@melvin-bot
Copy link

melvin-bot bot commented Jul 22, 2023

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@melvin-bot melvin-bot bot added the Overdue label Jul 24, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 24, 2023

@mateocole Whoops! This issue is 2 days overdue. Let's get this updated quick!

@mateocole mateocole added the External Added to denote the issue can be worked on by a contributor label Jul 26, 2023
@melvin-bot melvin-bot bot changed the title Web - Group user avatar icons re-arrange [$1000] Web - Group user avatar icons re-arrange Jul 26, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 26, 2023

Job added to Upwork: https://www.upwork.com/jobs/~014473a252a569df0c

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

melvin-bot bot commented Jul 26, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 26, 2023

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

@ben-macpherson
Copy link

It seems to me sortedParticipantDetails uses the .sort method incorrectly. Subtracting strings will always result in NaN causing the order to remain the same. I propose an alternative sort that will work correctly.

@melvin-bot
Copy link

melvin-bot bot commented Jul 26, 2023

📣 @ben-macpherson! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@ben-macpherson
Copy link

Contributor details
Your Expensify account email: ben@benmacpherson.dev
Upwork Profile Link: https://www.upwork.com/freelancers/~014c2e3563b80ff02e

@melvin-bot
Copy link

melvin-bot bot commented Jul 26, 2023

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@melvin-bot
Copy link

melvin-bot bot commented Jul 26, 2023

@mananjadhav, @mateocole Huh... This is 4 days overdue. Who can take care of this?

@melvin-bot melvin-bot bot removed the Overdue label Jul 27, 2023
@conorpendergrast conorpendergrast added Overdue Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels Jul 27, 2023
@melvin-bot melvin-bot bot added the Weekly KSv2 label Aug 17, 2023
@melvin-bot melvin-bot bot added Monthly KSv2 and removed Weekly KSv2 labels Sep 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

This issue has not been updated in over 15 days. @cead22, @mananjadhav, @honnamkuan, @lschurr eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@mananjadhav
Copy link
Collaborator

PR is ready and reviewed. Just needs to be merged.

cc - @cead22

@melvin-bot
Copy link

melvin-bot bot commented Sep 22, 2023

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

  • when @honnamkuan got assigned: 2023-08-16 19:31:34 Z
  • when the PR got merged: 2023-09-22 05:04:38 UTC
  • days elapsed: 26

On to the next one 🚀

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Monthly KSv2 labels Sep 25, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Web - Group user avatar icons re-arrange [HOLD for payment 2023-10-02] [$1000] Web - Group user avatar icons re-arrange Sep 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 25, 2023

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Sep 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 25, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.73-1 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-10-02. 🎊

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

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

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 Sep 25, 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:

  • [@mananjadhav] The PR that introduced the bug has been identified. Link to the PR:
  • [@mananjadhav] 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:
  • [@mananjadhav] 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:
  • [@mananjadhav] Determine if we should create a regression test for this bug.
  • [@mananjadhav] 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.
  • [@lschurr] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@lschurr
Copy link
Contributor

lschurr commented Sep 28, 2023

@mananjadhav could you work on the checklist for this one?

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Oct 1, 2023
@himanshuragi456
Copy link
Contributor

Where do I have to apply for payment? I can't find an upwork link here.
cc: @mananjadhav @cead22

@lschurr
Copy link
Contributor

lschurr commented Oct 2, 2023

@mananjadhav - bump on the checklist here.

@melvin-bot melvin-bot bot removed the Overdue label Oct 2, 2023
@lschurr
Copy link
Contributor

lschurr commented Oct 2, 2023

Could you add your Upwork profile here @himanshuragi456? I can invite you to the job.

@himanshuragi456
Copy link
Contributor

@lschurr
Copy link
Contributor

lschurr commented Oct 2, 2023

Payment summary:

@lschurr
Copy link
Contributor

lschurr commented Oct 2, 2023

Payments have been made for @himanshuragi456 and @honnamkuan in Upwork.

We can close this out once the checklist is complete @mananjadhav

@mananjadhav
Copy link
Collaborator

mananjadhav commented Oct 2, 2023

@lschurr I don't think we have an offending PR here as the we only worked on the improving the sort order. But I do think we need a regression test suite here.

Regression Test

  1. Open the app
  2. Click on FAB > New Group
  3. Create a new group with several members
  4. Validate that when group get created, the member avatars are sorted by their display name / login, and then accountId (if two accounts have the same displayName)
  5. Also ensure that the avatars does not get rearranged and remain in the same position.

wdyt @lschurr @cead22 ?

Also I've raised my payout request on NewDot.

@lschurr
Copy link
Contributor

lschurr commented Oct 2, 2023

Great, I've requested the regression test be added. Closing this one out.

@lschurr lschurr closed this as completed Oct 2, 2023
@JmillsExpensify
Copy link

$1,000 payment approved for @mananjadhav based on BZ summary.

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 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests