[QBD] Handle errors gracefully if the setup link cannot be obtained#51850
Conversation
| if (response.jsonCode === CONST.JSON_CODE.SUCCESS) { | ||
| setCodatSetupLink(String(response?.setupUrl ?? '')); | ||
| } else { | ||
| setConnectionError(policyID, CONST.POLICY.CONNECTIONS.NAME.QBD, translate('workspace.qbd.setupPage.setupErrorTitle')); |
There was a problem hiding this comment.
There was a problem hiding this comment.
Hi @hoangzinh, we do not send via Pusher this error, it is returned instead in the response's body on the PHP side.
There was a problem hiding this comment.
Then, I guess I have to set optimistic error here
| setupErrorTitle: '¡Ups! Ha ocurrido un error', | ||
| setupErrorBody1: 'La conexión con QuickBooks Desktop no está funcionando en este momento. Por favor, inténtalo de nuevo más tarde o', | ||
| setupErrorBody2: 'si el problema persiste.', | ||
| setupErrorBodyContactConcierge: 'contacta con Concierge', |
There was a problem hiding this comment.
Translation confirmation: https://expensify.slack.com/archives/C01GTK53T8Q/p1730714116839409
|
@ZhenjaHorbach Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
@lakchote currently, I have to mock the response body in order to test this PR. If you can give us a test in your local with a real mock BE error response, that would be great. |
Reviewer Checklist
Screenshots/VideosAndroid: NativeNA Android: mWeb ChromeNA iOS: NativeNA iOS: mWeb SafariNA MacOS: Chrome / Safariweb.movMacOS: Desktop2024-11-06.10.01.35.mov |
You have what is being returned e.g a real response in the related issue. Is that what you meant? |
|
@hoangzinh 2024-11-05.17.44.09.movAnd I suppose we shouldn't have access to options (import, export, advanced) |
| connections: { | ||
| [connectionName]: { | ||
| lastSync: { | ||
| isSuccessful: false, |
There was a problem hiding this comment.
I think we can add isConnected: false or changeisSuccessful toisConnected here to not show options
App/src/libs/actions/connections/index.ts
Lines 314 to 328 in 955872a
There was a problem hiding this comment.
@ZhenjaHorbach do you mean BE (Pusher event) sent isConnected=true in your case?
There was a problem hiding this comment.
No
When we have an error
We don't receive anything
But in case an error we save in Onyx this using setConnectionError
lastSync: {
"isSuccessful": false,
"errorDate": "2024-11-06T06:20:52.757Z",
"errorMessage": "Something went wrong"
}
As result we return false here
App/src/libs/actions/connections/index.ts
Lines 314 to 328 in 955872a
and show options
For example when we have correct response with setupLink we save "isConnected": false in Onyx and don't show options because shouldHideConfigurationOptions === true
lastSync: {
"errorDate": "",
"errorMessage": "",
"isAuthenticationError": false,
"isConnected": false,
"isSuccessful": false,
"source": "",
"successfulDate": ""
}
There was a problem hiding this comment.
ah I see. Good catch
@lakchote Not really, I mean, somehow hard-coded 666 error (setup URL not found) in the local BE, to test if it shows correctly in the FE. |
@ZhenjaHorbach it's weird. If the syncConnection hasn't been called yet, it won't be showed something like that. |
|
Now everything looks good ! 2024-11-06.10.01.35.mov |
|
LGTM ! |
|
Tests well too. Thanks @hoangzinh @ZhenjaHorbach. Screen.Recording.2024-11-06.at.10.17.00.mov |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/lakchote in version: 9.0.59-0 🚀
|
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.0.59-3 🚀
|
| {isLoading || !codatSetupLink ? ( | ||
| <FullScreenLoadingIndicator style={[styles.flex1, styles.pRelative]} /> | ||
| ) : ( | ||
| {shouldShowLoading && <FullScreenLoadingIndicator style={[styles.flex1, styles.pRelative]} />} |
There was a problem hiding this comment.
Looks like handling loading via FullScreenLoadingIndicator led to this issue:
which we agreed on fixing by showing the setup link UI right away when RHP opens and displaying an ActivityIndicator in the link box while hasResultOfFetchingSetupLink is being fetched.

Explanation of Change
Fixed Issues
$ #51640
PROPOSAL:
Tests
Offline tests
QA Steps
Same as above
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
N/A
Android: mWeb Chrome
N/A
iOS: Native
N/A
iOS: mWeb Safari
N/A
MacOS: Chrome / Safari
Screen.Recording.2024-11-05.at.17.44.11.mov
MacOS: Desktop
Screen.Recording.2024-11-05.at.17.54.44.mov