Skip to content

Commit b516c3f

Browse files
authored
Merge pull request Expensify#89806 from ShridharGoel/gusto1.10
[NoQA] Fix Accounting setup options with Gusto connected
2 parents 11099bf + 794f8f3 commit b516c3f

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/pages/workspace/accounting/PolicyAccountingPage.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) {
107107
const accountingIntegrations = CONST.POLICY.CONNECTIONS.ACCOUNTING_CONNECTION_NAMES;
108108
const syncingAccountingIntegration = accountingIntegrations.find((integration) => integration === connectionSyncProgress?.connectionName);
109109
const connectedIntegration = getConnectedIntegration(policy, accountingIntegrations) ?? syncingAccountingIntegration;
110+
const hasAccountingConnection = hasAccountingConnections(policy);
110111
const synchronizationError = connectedIntegration && getSynchronizationErrorMessage(policy, connectedIntegration, isSyncInProgress, translate, styles);
111112

112113
const shouldShowEnterCredentials = connectedIntegration && !!synchronizationError && isAuthenticationError(policy, connectedIntegration);
@@ -295,7 +296,7 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) {
295296
}, [connectedIntegration, currentXeroOrganization?.id, policy, policyID, styles.fontWeightNormal, styles.sectionMenuItemTopDescription, tenants.length, translate, icons.ArrowRight]);
296297

297298
const connectionsMenuItems: MenuItemData[] = useMemo(() => {
298-
if (isEmptyObject(policy?.connections) && !isSyncInProgress && policyID) {
299+
if (!hasAccountingConnection && !isSyncInProgress && policyID) {
299300
return accountingIntegrations
300301
.map((integration) => {
301302
const integrationData = getAccountingIntegrationData(
@@ -465,11 +466,12 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) {
465466
/>
466467
),
467468
},
468-
...(isEmptyObject(integrationSpecificMenuItems) || shouldShowSynchronizationError || isEmptyObject(policy?.connections) ? [] : [integrationSpecificMenuItems]),
469-
...(isEmptyObject(policy?.connections) || !isConnectionVerified ? [] : configurationOptions),
469+
...(isEmptyObject(integrationSpecificMenuItems) || shouldShowSynchronizationError || !hasAccountingConnection ? [] : [integrationSpecificMenuItems]),
470+
...(!hasAccountingConnection || !isConnectionVerified ? [] : configurationOptions),
470471
];
471472
}, [
472473
policy,
474+
hasAccountingConnection,
473475
isSyncInProgress,
474476
policyID,
475477
connectedIntegration,
@@ -504,7 +506,7 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) {
504506
]);
505507

506508
const otherIntegrationsItems = useMemo(() => {
507-
if ((isEmptyObject(policy?.connections) && !isSyncInProgress) || !policyID) {
509+
if ((!hasAccountingConnection && !isSyncInProgress) || !policyID) {
508510
return;
509511
}
510512
const otherIntegrations = accountingIntegrations.filter(
@@ -562,7 +564,7 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) {
562564
})
563565
.filter(Boolean) as MenuItemWithLink[];
564566
}, [
565-
policy?.connections,
567+
hasAccountingConnection,
566568
isSyncInProgress,
567569
accountingIntegrations,
568570
connectionSyncProgress?.connectionName,

0 commit comments

Comments
 (0)