-
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
[CP Staging] Make sure that we first check the PersonalDetails we already have before creating fake optimistic personal details #20951
Conversation
…ore creating fake optimistic personal details
@aimane-chnaif 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] |
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.
Code looks good but actually I am not convinced about the solution in #20661 which caused this regression.
Was there any reason why we couldn't fix the root cause instead of adding optimistic temporary user details? This used to work before personal details migration even without that optimistic data.
@aimane-chnaif I know we added this because when the page was redirecting to the new chat (which may not have existed at that point) it was very possible we hadn't loaded the user's personal details at that point - so this was needed. And now'days we're sending less personalDetails from the server to the front-end in order to limit the amount of logins being sent everywhere. A.k.a. we're trying to be more secure about who we send login information to, because we don't want absolutely everyone to be able to see everyone's contact info always. Additionally, we used to do pretty much everything w/ logins & default to viewing logins everywhere but now since we're trying to only access personalDetailsList - which is keyed by accountID - I thinkkk this was a necessary change |
It makes sense. Thanks for the explanation. |
@aimane-chnaif this is fixing a deploy blocker so it would be great if you could test this quickly today 🙏 |
I think one more condition should be added in Tests step: |
@@ -420,7 +428,7 @@ function openReport(reportID, participantLoginList = [], newReportObject = {}, p | |||
const optimisticPersonalDetails = {}; | |||
_.map(participantLoginList, (login, index) => { | |||
const accountID = newReportObject.participantAccountIDs[index]; | |||
optimisticPersonalDetails[accountID] = { | |||
optimisticPersonalDetails[accountID] = allPersonalDetails[accountID] || { |
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.
This can be called before getting allPersonalDetails
so just for null safety:
optimisticPersonalDetails[accountID] = allPersonalDetails[accountID] || { | |
optimisticPersonalDetails[accountID] = (allPersonalDetails && allPersonalDetails[accountID]) || { |
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.
I don't know if this is needed since we already default allPersonalDetails
to {}
at the top of the file, if the data in that key doesn't exist
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.
That's really true. I think this is also redundant:
Line 842 in ffd9672
(allPersonalDetails && allPersonalDetails[accountID]) || { |
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.
agreed
Sorry @aimane-chnaif can you write this in exact steps you think the test should cover? I don't quite understanding what you're trying to test here, sorry |
|
@aimane-chnaif thanks, yes that sounds like a very useful test to add 👍 |
Reviewer Checklist
Screenshots/VideosWebweb.movMobile Web - Chromemchrome.movMobile Web - Safarimsafari.movDesktopdesktop.moviOSios.movAndroidandroid.mov |
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.
Both online / offline tests pass.
Default avatar flickers when create chat with new contact. I think this is inevitable since we don't know accountID before fetching backend.
We did not find an internal engineer to review this PR, trying to assign a random engineer to #20943... Please reach out for help on Slack if no one gets assigned! |
|
[CP Staging] Make sure that we first check the PersonalDetails we already have before creating fake optimistic personal details (cherry picked from commit 8456d27)
…-20951 🍒 Cherry pick PR #20951 to staging 🍒
🚀 Cherry-picked to staging by https://github.com/luacmartins in version: 1.3.29-3 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by https://github.com/luacmartins in version: 1.3.29-11 🚀
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 1.3.32-1 🚀
|
🚀 Deployed to production by https://github.com/thienlnam in version: 1.3.32-5 🚀
|
@Beamanator please review
Details
I believe this was introduced in this PR: #20661
cc @BeeMargarida
We were unnecessarily creating optimistic personal details objects for users we may already have had personal details objects stored in Onyx. Instead of creating an optimistic personal detail for everyone in a new group chat, create an optimistic personal detail only if we can't find one already in Onyx.
Fixed Issues
$ #20943
Tests/QA
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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
Web
Kapture.2023-06-16.at.15.48.09.mp4
Mobile Web - Chrome
Kapture.2023-06-16.at.16.35.17.mp4
Mobile Web - Safari
Kapture.2023-06-16.at.15.52.36.mp4
Desktop
Kapture.2023-06-16.at.16.37.55.mp4
iOS
Kapture.2023-06-16.at.16.38.58.mp4
Android
Kapture.2023-06-16.at.16.32.10.mp4