-
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] Fix greyed out workspace icon for workspace distance requests #33005
Conversation
@cubuspl42 @ One of you needs to 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] |
Hah, and the linter is failing because we prefer |
src/libs/ReportUtils.ts
Outdated
@@ -1211,7 +1211,8 @@ function getDefaultWorkspaceAvatar(workspaceName?: string): React.FC<SvgProps> { | |||
|
|||
function getWorkspaceAvatar(report: OnyxEntry<Report>): UserUtils.AvatarSource { | |||
const workspaceName = getPolicyName(report, false, allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]); | |||
return allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.avatar ?? getDefaultWorkspaceAvatar(workspaceName); | |||
const avatar = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.avatar; | |||
return avatar ? avatar : getDefaultWorkspaceAvatar(workspaceName); |
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.
return avatar ? avatar : getDefaultWorkspaceAvatar(workspaceName); | |
return avatar && avatar !== '' ? avatar : getDefaultWorkspaceAvatar(workspaceName); |
This looks ugly but inevitable to avoid ts error.
Otherwise disable lint on this line
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.
Opted for following which I think is a little nicer
const avatar = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.avatar ?? '';
return !isEmpty(avatar) ? avatar : getDefaultWorkspaceAvatar(workspaceName);
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 try to avoid lodash, underscore in TS
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.
https://github.com/Expensify/App/blob/main/contributingGuides/TS_STYLE.md#migration-guidelines
But seems like isEmpty
is already used in this file
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.
Hmm, I was also wondering whether isEmpty
couldn't be replaced with avatar !== ''
here (even after the latest change), but I'm only 90% sure this is equivalent. JavaScript's handling of emptiness/truthness scares me.
The code looks good, I'll start the testing & checklist 👍 |
Hey @cubuspl42, could you please @ me once thereview is complete and I'll get it merged and CP'd to prod. Thank you! |
This was a regression from the TS migration PR @kubabutkiewicz @shubham1206agra |
Reviewer Checklist
Screenshots/VideosDesktop |
@marcochavezf 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] |
Wow, light mode is done |
Cherry-picking now |
[CP Staging] Fix greyed out workspace icon for workspace distance requests (cherry picked from commit 8c7ebaf)
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Cherry-picked to staging by https://github.com/Julesssss in version: 1.4.12-2 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by https://github.com/Julesssss in version: 1.4.12-2 🚀
|
Details
Use
||
instead of??
sinceallPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]?.avatar
can return''
Fixed Issues
$ #32984
PROPOSAL: N/A
Tests
Offline tests
N/A
QA Steps
Same as test 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)StyleUtils.getBackgroundAndBorderStyle(theme.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
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
(reported on Web only)Screen.Recording.2023-12-13.at.11.44.16.mov
MacOS: Desktop