-
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
fix: regressions related to workspace avatars #41485
Conversation
@ahmedGaber93 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] |
@rushatgabhane this a regression from #39637, I don't think it is needed a new C+. |
src/components/MenuItem.tsx
Outdated
@@ -259,6 +259,9 @@ type MenuItemBaseProps = { | |||
|
|||
/** Handles what to do when the item is focused */ | |||
onFocus?: () => void; | |||
|
|||
/** Optional account id if it's user avatar or policy id if it's workspace avatar */ | |||
accountId?: number | string; |
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.
accountId?: number | string; | |
accountID?: number | string; |
we might be doing a revert of original PR - https://expensify.slack.com/archives/C01GTK53T8Q/p1715183132740789 |
Thanks for linking this 👍 |
Running a test build |
This comment has been minimized.
This comment has been minimized.
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.
Hey, I spent a lot of time with avatar code so I wanted to leave a few comments here.
After the previous PR there is also a bug in this line: https://github.com/Expensify/App/blob/main/src/components/MultipleAvatars.tsx#L147
Because we started to pass also policyID
as icon id, and it can be string, then this parsing will generate NaN
and Nan gets passed as accountID
.
Previously only actual account ids were passed to icons so this didn't happen I believe.
It would be nice to handle this somehow.
src/components/MenuItem.tsx
Outdated
@@ -334,6 +337,7 @@ function MenuItem( | |||
isPaneMenu = false, | |||
shouldPutLeftPaddingWhenNoIcon = false, | |||
onFocus, | |||
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.
Can you point to me where in the code this will actually be used? because in this PR your not passing accountID
anywhere to MenuItem
and I would like understand the flow of props better.
Also please don't default to ''
- accountID makes no sense with empty value.
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.
Thanks your comment
I missed adding props in MoneyRequestConfirmationList when resolving conflict
@@ -35,7 +35,7 @@ function ReportAvatar({report = {} as Report, policies, isLoadingApp = true}: Re | |||
}} | |||
isWorkspaceAvatar | |||
maybeIcon | |||
originalFileName={policy?.originalFileName ?? policyName} | |||
originalFileName={policy?.originalFileName ?? policy?.id} |
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.
Technically this will work, but the prop name is called originalFileName
so passing policy.id
will confuse people in future.
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 added a comment to explain, please check again
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.
Can we add why we need to do this?
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.
// In the case of the default workspace avatar, we will use the policy id that will be originalFileName prop to get the color of the avatar.
@MonilBhavsar I added a comment.
@nkdengineer please fix the multiple avatars/subscript avatar case |
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, but we need to fix the case I commented before me merge
Reviewer Checklist
Screenshots/VideosAndroid: mWeb ChromeMacOS: Desktop |
src/components/MenuItem.tsx
Outdated
/** Optional account id if it's user avatar or policy id if it's workspace avatar */ | ||
accountID?: number | string; |
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.
Having a prop with name accountID and holding value of policyID is confusing IMO.
We can either have two props - policyID and accountID and use one that's provided - policyID ?? accountID
Or, we can have a prop avatarID
that takes either policyID or 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 think avatarID
is fine.
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.
@MonilBhavsar I updated with new prop name
@@ -35,7 +35,7 @@ function ReportAvatar({report = {} as Report, policies, isLoadingApp = true}: Re | |||
}} | |||
isWorkspaceAvatar | |||
maybeIcon | |||
originalFileName={policy?.originalFileName ?? policyName} | |||
originalFileName={policy?.originalFileName ?? policy?.id} |
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.
Can we add why we need to do this?
@nkdengineer could you merge main? |
@grgia please check again |
@rushatgabhane could you please re-review |
triggering final test build... |
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪 |
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.
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.
Minor comment edit to explain it in a better way. Looks good overall!
Co-authored-by: Monil Bhavsar <monilbhavsar25@gmail.com>
@MonilBhavsar I updated. |
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.
Thank you!
✋ 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/MonilBhavsar in version: 1.4.75-0 🚀
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.75-1 🚀
|
Details
Fixed Issues
$ #41385
#41387
PROPOSAL:
Tests
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
android-mweb.mov
iOS: Native
ios.mov
iOS: mWeb Safari
ios-mweb.mov
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov