[QBO] Prevent making an unwanted API call - #53115
Conversation
|
@paultsimura 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 this need a C+ review, right? |
Yes this does! I've assigned you to the underlying issue. |
|
Thanks, I'll review today👍 |
|
@lakchote WDYT about returning early inside the QBO function instead (to make this prevention logic potentially more reusable)? function updateQuickbooksOnlineCollectionAccountID<TSettingValue extends QBOConnectionConfig['collectionAccountID']>(
policyID: string,
settingValue: TSettingValue,
oldSettingValue?: TSettingValue,
) {
+ if (settingValue === oldSettingValue) {
+ return;
+ }
const {optimisticData, failureData, successData} = buildOnyxDataForQuickbooksConfiguration(policyID, CONST.QUICKBOOKS_CONFIG.COLLECTION_ACCOUNT_ID, settingValue, oldSettingValue);
App/src/libs/actions/connections/QuickbooksOnline.ts Lines 337 to 350 in ee68279 |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / Safari2024-11-26.-.21.27.-.Screen.Recording.2024-11-26.at.21.16.09.mp4MacOS: Desktop2024-11-26.-.21.27.-.Screen.Recording.2024-11-26.at.21.27.09.mp4 |
|
@lakchote bump on #53115 (comment) so it won't get lost under my checklist. |
It does makes sense! I've updated the PR. |
| if (value !== qboConfig?.reimbursementAccountID) { | ||
| QuickbooksOnline.updateQuickbooksOnlineReimbursementAccountID(policyID, value, qboConfig?.reimbursementAccountID); | ||
| } | ||
| QuickbooksOnline.updateQuickbooksOnlineReimbursementAccountID(policyID, value, qboConfig?.reimbursementAccountID); |
There was a problem hiding this comment.
I think this change is accidental. You probably wanted to revert the first commit, which is in src/pages/workspace/accounting/qbo/advanced/QuickbooksInvoiceAccountSelectPage.tsx.
Otherwise, you should introduce the early return to the updateQuickbooksOnlineReimbursementAccountID function as well and keep this change. I would say it's worth doing.
There was a problem hiding this comment.
Yes, you're right.
Let's do the same logic for QuickbooksAccountSelectPage.tsx though, and make the methods handle the possibility of setting the same value, to improve reusability.
|
✋ 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/nkuoch in version: 9.0.68-0 🚀
|
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.0.68-7 🚀
|
Explanation of Change
Fixed Issues
$ #53114
Tests
Offline tests
NA
QA Steps
Same as in tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.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 so 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./** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
qbo_fixed.mov
MacOS: Desktop