-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Remove getPolicy usages from enabling more features and invoice company info #86074
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
Changes from all commits
7c41a8f
e18de43
61713ce
ef0068a
0b7f8f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -131,7 +131,7 @@ function WorkspaceUpgradePage({route}: WorkspaceUpgradePageProps) { | |||
| return; | ||||
| } | ||||
|
|
||||
| upgradeToCorporate(policy.id, feature?.name); | ||||
| upgradeToCorporate(policy, feature?.name); | ||||
| }; | ||||
|
|
||||
| // useCallback is needed here because confirmUpgrade is passed as a prop to child components; | ||||
|
|
@@ -186,7 +186,7 @@ function WorkspaceUpgradePage({route}: WorkspaceUpgradePageProps) { | |||
| } | ||||
| break; | ||||
| case CONST.UPGRADE_FEATURE_INTRO_MAPPING.rules.id: | ||||
| enablePolicyRules(policyID, true, false, policyDataRef.current); | ||||
| enablePolicyRules(policy, true, false, policyDataRef.current); | ||||
| break; | ||||
| case CONST.UPGRADE_FEATURE_INTRO_MAPPING.companyCards.id: | ||||
| enableCompanyCards(policyID, true, false); | ||||
|
|
@@ -203,8 +203,7 @@ function WorkspaceUpgradePage({route}: WorkspaceUpgradePageProps) { | |||
| categoryId, | ||||
| feature, | ||||
| perDiemCustomUnit?.customUnitID, | ||||
| policy?.connections?.xero?.config, | ||||
| policy?.connections?.xero?.data, | ||||
| policy, | ||||
|
bernhardoj marked this conversation as resolved.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this a performance concern? The policy object is very big and any change on it could trigger rerenders
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We subscribe to the policy onyx, so it already re-renders anytime the policy changes, but yes, it will re-create this function too, same as other functions. I pass the whole policy object to App/src/libs/actions/Policy/Policy.ts Line 4898 in 0adae4c
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. This is a page the user doesn't visit often, so maybe it is fine for now. We'll refactor the whole thing if it becomes a real problem 👍 |
||||
| policyID, | ||||
| qboConfig?.syncClasses, | ||||
| qboConfig?.syncCustomers, | ||||
|
|
||||
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.
Do we need 3 types here?
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
taxRatesis only being used forshouldAddDefaultTaxRatesDataand is only useful whenenabledis true.There are a few places where we call
enablePolicyTaxesto disable the taxes. If we always pass thetaxRates, we will unnecessarily subscribe to the onyx. (for example)App/src/components/ConnectToQuickbooksOnlineFlow/index.native.tsx
Lines 17 to 30 in 0adae4c