-
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 Preferred exporter page + country crash #41530
Changes from all commits
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import React, {useCallback, useEffect, useMemo} from 'react'; | ||
import React, {useCallback, useMemo} from 'react'; | ||
import {View} from 'react-native'; | ||
import type {SectionListData} from 'react-native'; | ||
import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
|
@@ -30,17 +30,8 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyConnec | |
const {reimbursableExpensesExportDestination, syncTax, syncLocations} = policy?.connections?.quickbooksOnline?.config ?? {}; | ||
const isLocationsEnabled = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); | ||
const isTaxesEnabled = Boolean(syncTax); | ||
const isTaxError = isTaxesEnabled && reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY; | ||
const isLocationError = isLocationsEnabled && reimbursableExpensesExportDestination !== CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY; | ||
const policyID = policy?.id ?? ''; | ||
|
||
useEffect(() => { | ||
if (!isTaxError && !isLocationError) { | ||
return; | ||
} | ||
Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.REIMBURSABLE_EXPENSES_EXPORT_DESTINATION); | ||
}, [policyID, isTaxError, isLocationError]); | ||
|
||
const data: CardListItem[] = useMemo( | ||
Comment on lines
-37
to
-43
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. This was calling 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 can fix this as part 1. of this issue: https://github.com/Expensify/Expensify/issues/390731 |
||
() => [ | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,7 @@ function QuickbooksImportPage({policy}: WithPolicyProps) { | |
}, | ||
]; | ||
|
||
if (policy?.connections?.quickbooksOnline.data.country !== CONST.COUNTRY.US) { | ||
if (policy?.connections?.quickbooksOnline?.data?.country !== CONST.COUNTRY.US) { | ||
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. 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. hmm that is probably a good idea, then we wouldn't get a random crash because our types would catch it 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. |
||
sections.push({ | ||
description: translate('workspace.accounting.taxes'), | ||
action: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_TAXES.getRoute(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.
Fixed this here because
settingValue
is NOT optional. This was causing backend server errors.