-
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
Add error message in case of integration sync failure #42307
Changes from 6 commits
68b7551
08b321a
ecdeaf4
e87d711
27972bf
de93763
ef5d777
5979a35
52216fb
25db9b7
b779dff
86f509f
adddbcd
4ce01d2
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 |
---|---|---|
|
@@ -2340,6 +2340,17 @@ export default { | |
} | ||
} | ||
}, | ||
syncError: (integration?: ConnectionName): string => { | ||
switch (integration) { | ||
case CONST.POLICY.CONNECTIONS.NAME.QBO: | ||
return "Couldn't connect to QuickBooks Online due to incorrect credentials."; | ||
case CONST.POLICY.CONNECTIONS.NAME.XERO: | ||
return "Couldn't connect to Xero due to incorrect credentials."; | ||
default: { | ||
return "Couldn't connect to integration due to incorrect credentials."; | ||
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 don't know if "due to incorrect credentials" is the correct thing to say here. The 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. Thank you François for answering quickly my previous question and raising this point! cc @trjExpensify @zanyrenney in the Xero DD, and in the Figma we would show this But since it can be a lot of completely different things, maybe we need to change it? Before having this discussion, I suggested to @SzymczakJ using as copy something like 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. Zany might have more context, but I think this was just an example where incorrect credentials are at fault, but the intention is to pass in the most relevant error we have. Do we not have all of these in OldDot already? 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. Okay so after investigating, when sync fails, we have error codes ( Currently on OD, the Xero error message when session has expired is:
It appears in a modal like below: We also have dynamic error messages in place (we could reuse the same thought process for QBO):
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. Okay cool, so in this case for NewDot, would the button inside the three dot overflow menu read 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. Looks like we might want to keep it, at least for errors when connecting (not autoSync/export/manual export errors that are out of scope). Especially to demo it at XeroCon. 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. Yeah I think we can keep it though the error we show here should just a generic message like Francois mentioned 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. Yes, when connecting I agree. 👍 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. So I should proceed with generic error message like "Couldn't connect to {integration}.", right? @trjExpensify 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. Yep! This one I believe:
|
||
} | ||
} | ||
}, | ||
accounts: 'Chart of accounts', | ||
taxes: 'Taxes', | ||
imported: 'Imported', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ import usePermissions from '@hooks/usePermissions'; | |
import useTheme from '@hooks/useTheme'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import useWindowDimensions from '@hooks/useWindowDimensions'; | ||
import {removePolicyConnection, syncConnection} from '@libs/actions/connections'; | ||
import {hasSynchronizationError, removePolicyConnection, syncConnection} from '@libs/actions/connections'; | ||
import {findCurrentXeroOrganization, getCurrentXeroOrganizationName, getXeroTenants} from '@libs/PolicyUtils'; | ||
import Navigation from '@navigation/Navigation'; | ||
import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; | ||
|
@@ -41,7 +41,7 @@ import type {PolicyConnectionName} from '@src/types/onyx/Policy'; | |
import {isEmptyObject} from '@src/types/utils/EmptyObject'; | ||
import type IconAsset from '@src/types/utils/IconAsset'; | ||
|
||
type MenuItemData = MenuItemProps & {pendingAction?: OfflineWithFeedbackProps['pendingAction']}; | ||
type MenuItemData = MenuItemProps & {pendingAction?: OfflineWithFeedbackProps['pendingAction']; errors?: OfflineWithFeedbackProps['errors']}; | ||
|
||
type PolicyAccountingPageOnyxProps = { | ||
connectionSyncProgress: OnyxEntry<PolicyConnectionSyncProgress>; | ||
|
@@ -172,7 +172,9 @@ function PolicyAccountingPage({policy, connectionSyncProgress}: PolicyAccounting | |
wrapperStyle: [styles.sectionMenuItemTopDescription], | ||
shouldShowRightComponent: true, | ||
title: integrationData?.title, | ||
|
||
errorText: hasSynchronizationError(policy, connectedIntegration) ? translate('workspace.accounting.syncError', connectedIntegration) : undefined, | ||
errorTextStyle: {marginTop: 8}, | ||
shouldShowErrorTextRedDot: true, | ||
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. should it be always true? 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. In the majority of cases we use this error text without a red dot, so I decided to use shouldShowErrorTextRedDot this way. |
||
description: isSyncInProgress | ||
? translate('workspace.accounting.connections.syncStageName', connectionSyncProgress.stageInProgress) | ||
: translate('workspace.accounting.lastSync'), | ||
|
@@ -250,21 +252,23 @@ function PolicyAccountingPage({policy, connectionSyncProgress}: PolicyAccounting | |
]), | ||
]; | ||
}, [ | ||
connectedIntegration, | ||
connectionSyncProgress?.stageInProgress, | ||
currentXeroOrganization, | ||
currentXeroOrganizationName, | ||
tenants, | ||
policy, | ||
isSyncInProgress, | ||
overflowMenu, | ||
policy?.connections, | ||
policyConnectedToXero, | ||
connectedIntegration, | ||
policyID, | ||
styles, | ||
translate, | ||
styles.sectionMenuItemTopDescription, | ||
styles.popoverMenuIcon, | ||
styles.fontWeightNormal, | ||
connectionSyncProgress?.stageInProgress, | ||
theme.spinner, | ||
overflowMenu, | ||
threeDotsMenuPosition, | ||
translate, | ||
policyConnectedToXero, | ||
currentXeroOrganizationName, | ||
tenants.length, | ||
accountingIntegrations, | ||
currentXeroOrganization?.id, | ||
]); | ||
|
||
const otherIntegrationsItems = useMemo(() => { | ||
|
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 not name this as
shouldShowRedDotIndicator
? This is consistent across and red dot is generally associated with errors.