-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
FIX: Two QA guide entries in the member list after onboarding with Manage my team's expenses #54147
FIX: Two QA guide entries in the member list after onboarding with Manage my team's expenses #54147
Conversation
…nage my team's expenses
@dukenv0307 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
const personalDetailsFormatted = personalDetailsWithoutSelected.map((item) => OptionsListUtils.formatMemberForList(item)); | ||
const personalDetailsFormatted = personalDetailsWithoutSelected | ||
.map((item) => OptionsListUtils.formatMemberForList(item)) | ||
.filter((item, index, array) => item?.login && index === array.findIndex((i) => i.login === item.login)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should move the filter
logic before map
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we check item?.login
? We already filterout the item that doesn't have login here, so I think we don't need that check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should move the
filter
logic beforemap
.
@dukenv0307 Any specific reason for this request ? Like performance, proneness to error or anything else, curious to hear why you think the way it is now needs to be changed.
Should we check item?.login? We already filterout the item that doesn't have login here, so I think we don't need that check.
That filters out entries with non-existing login
(and other) key values, assuming you're familiar with the issue you just reviewed, the fix is filtering out two entries with the same login
key value since we don't want to show duplicates in case BE returns such entries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like performance
Yes, let's imagine we have 1k elements, after filter
, there are only 10 items so we just apply map
for 10 elements only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the fix is filtering out two entries with the same login key value since we don't want to show duplicates in case BE returns such entries.
That's right, so index === array.findIndex((i) => i.login === item.login)
is enough, adding item?.login
is useless to me and can cause the regression.
@ikevin127 There're many places that have the same issue like I think we should fix this issue in |
@dukenv0307 Usually I tend to keep things within scope as the proposal suggested since changing other parts of the logic exposes us to regressions. Have you been able to reproduce the issue where you are shown duplicated entries in any of the other lists ? If that's the case I wound't have any issue bringing this up in the issue and asking for a bounty increase since we're extending the scope which requires more work and testing, another reason why this would complicate things a lot is that: App/src/libs/OptionsListUtils.ts Lines 1736 to 1739 in 886d7ec
Will bring attention to these conversations within the issue as well, maybe I'm missing something. |
I believe we need to fix them all. |
Thanks for argumenting each change, they make the reasons clear - I will apply all changes then will tag for review. |
@ikevin127 Is it ready for review? Seem like we have 1 lint error but I'm not sure we have to fix it. |
@dukenv0307 Yes, it is ready for review.
I wanted to check first and I confirm that none of the lint issues are related to this PRs changes directly, they are showing because there were changes in the The thing is that most of the default values causing the errors in |
Reviewer Checklist
Screenshots/Videos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we know what's causing the ESLint failures? Perhaps another main merge would help?
Also, thanks for fixing the additional cases, but could we add a few more test cases to ensure that are verified by QA?
…7-fixInvideQAGuideDupe
@Julesssss I doubt that sync with main will help and yes, I described exactly what causes the failures in #54147 (comment), it happens because there were changes in a file - this case is similar to instances related to I've seen eslint issues like this being ignored before and that's my suggestion for this one as well since changing all the fallback values from ✅ Done: Added step (7.) on QA Steps detailing a wider range of lists with Contacts where the fix should apply. |
Thanks for the explanation and additional tests @ikevin127. Looks good to me |
@Julesssss looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/Julesssss in version: 9.0.78-0 🚀
|
🚀 Deployed to staging by https://github.com/Julesssss in version: 9.0.78-0 🚀
|
2 similar comments
🚀 Deployed to staging by https://github.com/Julesssss in version: 9.0.78-0 🚀
|
🚀 Deployed to staging by https://github.com/Julesssss in version: 9.0.78-0 🚀
|
🚀 Deployed to staging by https://github.com/Julesssss in version: 9.0.78-0 🚀
|
1 similar comment
🚀 Deployed to staging by https://github.com/Julesssss in version: 9.0.78-0 🚀
|
🚀 Deployed to staging by https://github.com/Julesssss in version: 9.0.78-0 🚀
|
This PR is failing because of issue #54563 |
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.0.78-6 🚀
|
Explanation of Change
Sometimes there's two QA guide entries in the member list after onboarding flow with Manage my team's expenses choice which seems to come from BE.
Real example of array with duplicated entries
Since we don't have bandwith to investigate this on BE side as stated in this comment, we decided to move forward with a FE fix which simply filters out duplicated values based on
login
key which is a unique identifier in our app.Fixed Issues
$ #53579
PROPOSAL: #53579 (comment)
Tests
Note
In order for the issue to be reproduced on DEV and subsequently be able to verify and review whether the fix works, it is necessary that Use Staging Server is set to ON in Onyx storage before creating the new account (random email without +) because when we create the workspace via onboarding flow, if we're not on staging server we won't be assigned the
qa.guide@team.expensify.com
guide.To do this we can add
Onyx.merge(ONYXKEYS.USER, {shouldUseStagingServer: true});
insrc/App.tsx
at the top of the functional component here, this would ensure you're using staging server and the issue will be reproduced 100% consistently - this will also help validate and review the proposed fix from this PR.+ Invite member
and verify that there's only oneqa.guide@team.expensify.com
entry in the list instead of two.Offline tests
N/A.
QA Steps
+ Invite member
and verify that there's only oneqa.guide@team.expensify.com
entry in the list instead of two.FAB -> Start chat list
FAB -> Create expense -> Manual, input amount and Next -> Choose recipient list
Bottom tab -> Reports (Search) -> Expenses -> Filters -> both From and To lists
FAB -> Start chat -> Create group chat -> Click group chat header -> Members ->
+ Invite member
listAny other list with Contacts within the app should pass the test and only show 1
qa.guide@team.expensify.com
entryVerify that no errors appear in the JS console
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop