-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Add delegate avatar component #48564
Conversation
@rushatgabhane 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] |
Taking over the review ♻️ |
@DylanDylann can you add testing steps here?, i can test this one but if we are going to QA this then we need those ! thanks |
BUG:When we swtich account to delegate, we cannot see the delegate profile untill we refresh, can you take a look @DylanDylann : Screen.Recording.2024-09-04.at.8.56.03.PM.mov |
|
||
function AvatarWithDelegateAvatar({delegateEmail, isSelected = false}: AvatarWithDelegateAvatarProps) { | ||
const styles = useThemeStyles(); | ||
const personalDetail = PersonalDetailsUtils.getPersonalDetailByEmail(delegateEmail); |
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.
perhaps put this one under useCallback or something which will trigger a re-render
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.
Seems like both of those have something to do with not correctly loading personal details?
@dangrous
I consoled logged the vairable which stores the personal details, it show undefined unless we refresh page:
const personalDetail = PersonalDetailsUtils.getPersonalDetailByEmail(delegateEmail);
Is not working as expected for the first load
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.
Oh i get it, we are calling the wrong util, that util gives us the cache, when we switch account there is none
@DylanDylann can you update the util please
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.
oh nice find. Alternately, is there a way we can preserve the personal details of the delegate account in the cache when we switch accounts (and past reload)? Trying to avoid unnecessary calls to the backend if we already have that info
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 have to use useOnyx. Otherwise the variable won't update when underlying data changes
Another BugI noticed if we switch back to original profile, the details do not load Screen.Recording.2024-09-04.at.9.15.02.PM.movThis doesn't happen if i switch to main and do the same action |
For #48564 (comment), I can't reproduce but I think it is a BE bug |
Hm so I can reproduce on Either way shouldn't block this PR |
I feel we should clear all the data related to previous account when switching and load new accounts data, are we doing this currently?
Ahh we still have a blocking bug though this |
Seems like both of those have something to do with not correctly loading personal details? |
@allgandalf Updated |
Love it, I think this one is ready for final review? @allgandalf can you take a look? |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-09-05.at.9.56.34.PM.movAndroid: mWeb ChromeScreen.Recording.2024-09-05.at.9.47.17.PM.movMacOS: Chrome / SafariScreen.Recording.2024-09-05.at.8.57.11.PM.movMacOS: DesktopScreen.Recording.2024-09-05.at.8.59.55.PM.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.
This looks good now, apart from the BE
bug we discovered here, this PR looks perfect, we can merge this 🚀
Though I think we determined that BE bug was actually a front end fix, adjusting where it comes from (not from the cache) right? |
I didn't follow this sorry, can you state again @dangrous |
Oh no, that solution was for the first bug reported here. But i checked again with @DylanDylann this PR and it seems to be resolved: Screen.Recording.2024-09-06.at.12.40.39.AM.mov
I guess it did fix this, we are good to merge then! |
Okay great! Yeah that OpenApp takes a bit of time but it gets there. Will review this fully now! |
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.
one comment change then we're good to go!
import ProfileAvatarWithIndicator from './ProfileAvatarWithIndicator'; | ||
|
||
type AvatarWithDelegateAvatarProps = { | ||
/** Emoji status */ |
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.
/** Emoji status */ | |
/** Original account of delegate */ |
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.
@DylanDylann is off for the night, i guess you can force push this commit @dangrous ? lets get the ball rolling imo
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 think I won't be able to merge if I do that unfortunately, a little wonky but @allgandalf can you add it into your PR? I'll go ahead and merge this as is.
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.
yes sure!
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.
Going to fix that comment in another PR, merging this to keep things moving.
✋ 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/dangrous in version: 9.0.30-4 🚀
|
Details
Fixed Issues
$ #46923
PROPOSAL: NA
Tests
Verify the delegate avatar display correct
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 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