-
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
Move policy employee list logic to ONYXKEYS.COLLECTION.POLICY_MEMBER_LIST
#10461
Conversation
ONYXKEYS.COLLECTION.POLICY_MEMBER_LIST
ONYXKEYS.COLLECTION.POLICY_MEMBER_LIST
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.
Mostly LGTM. Left few minor comments. I think we should also make a follow up issue to not get employeeList in the policy object to begin with.
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
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
role: CONST.POLICY.ROLE.ADMIN, | ||
outputCurrency: response.policy.outputCurrency, | ||
}), | ||
Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY_MEMBER_LIST}${response.policyID}`, getSimplifiedEmployeeList(response.policy.employeeList)), |
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.
Is it necessary to have both of these inside the promise.all? I don't think it matters when the member list is merged, does it? It also doesn't seem like it matters when the policy object is merged.
The only time the promise returned from create()
is used is to navigate to the policy, but I don't think any of that requires the policy stuff to be merged into Onyx yet, does it?
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 policy data would need to be merged otherwise the workspace page would briefly open as "Not Found" until the Onyx update finishes. I included the members list here also just to be safe. The functionality here is very temporary since it'll be replaced by incoming workspace refactors so I wouldn't lose too much sleep optimizing it.
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.
OK, while I am fine not doing anything since it's only temporary, I do think it's important to always make clear and appropriate choices with code, regardless of how long it's going to live.
@@ -98,13 +99,14 @@ export default function (WrappedComponent) { | |||
previousRouteName = currentRoute.name; | |||
previousRoutePolicyID = policyID; | |||
|
|||
const rest = _.omit(props, ['forwardedRef', 'policy']); | |||
const rest = _.omit(props, ['forwardedRef', 'policy', 'policyMemberList']); |
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.
Why are policy
and policyMemberList
removed from props, only to be added directly as props below? I think that forwardedRef
is the only one that needs removed from props
because it needs to be renamed to ref
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.
Honestly not sure about this one I just followed the existing pattern. I'll see if it makes a difference
Tests passing in staging 👍 |
return Promise.all( | ||
Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${response.policyID}`, { |
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.
FYI, There is a regression from this change #10667
Promise.all
accepts a single param as iterable.
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.
FYI @arosiclair I'm planning to hire a contributor to fix this, in #10665
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.
JK it was fixed elsewhere :D
Details
Points employee list logic to
ONYXKEYS.COLLECTION.POLICY_MEMBER_LIST
for loading and creating policies as well as inviting and removing membersFixed Issues
$ https://github.com/Expensify/Expensify/issues/223499
Tests
PR Review Checklist
Contributor (PR Author) Checklist
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
displayName
propertythis
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)PR Reviewer Checklist
The Contributor+ will copy/paste it into a new comment and complete it after the author checklist is completed
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
).src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
have been tested & I retested again)/** comment above it */
displayName
propertythis
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)QA Steps
Screenshots
Web
Screen.Recording.2022-08-19.at.4.46.52.PM.mov
Mobile Web
Desktop
iOS
Android