[HOLD for payment 2024-10-29] [$250] QBD - Category title link shows "undefined settings" when there is error with QBO connection
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.37-0 Reproducible in staging?: Y Reproducible in production?: Y Issue was found when executing this PR: https://github.com/Expensify/App/pull/48759 Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team
Action Performed:
Precondition:
- Workspace is connected to QBD on Old Dot and the set up is not completed to trigger the error.
- Go to staging.new.expensify.com
- Go to workspace settings.
- Go to Categories.
Expected Result:
The link in the header will not show "undefined settings".
Actual Result:
The link in the header shows "undefined settings". The same issue goes for Tags and Report fields.
Workaround:
Unknown
Platforms:
- [x] Android: Native
- [x] Android: mWeb Chrome
- [x] iOS: Native
- [x] iOS: mWeb Safari
- [x] MacOS: Chrome / Safari
- [x] MacOS: Desktop
Screenshots/Videos
https://github.com/user-attachments/assets/f0b8352f-c955-4c2b-bb39-91f45758265b
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~021837252793117015940
- Upwork Job ID: 1837252793117015940
- Last Price Increase: 2024-09-20
- Automatic offers:
- brunovjk | Contributor | 104158165
Issue Owner
Current Issue Owner: @alexpensify
Triggered auto assignment to @alexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
We think that this bug might be related to #wave-control
@alexpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
Edited by proposal-police: This proposal was edited at 2024-09-18 16:04:34 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
The category title link displays "undefined settings."
What is the root cause of that problem?
- The app displays
undefinedfor theQBOwhen using desktop because thequickbooksDesktopoption is not added to theCONNECTIONSnames list or the routes list. https://github.com/Expensify/App/blob/f2a4b87675eccb73c143c8b217a90884bc3ff3d9/src/CONST.ts#L2275-L2287
What changes do you think we should make in order to solve the problem?
-
Add QuickBooks Desktop alongside other supported connections from this list: https://github.com/Expensify/App/blob/f2a4b87675eccb73c143c8b217a90884bc3ff3d9/src/CONST.ts#L2287-L2296
-
Update this condition to support QuickBooks Desktop
-
updated other hardcoded connection objects across the project to include also the QuickBooks Desktop
What alternative solutions did you explore? (Optional)
Another solution would be to avoid displaying the categories below are imported from... message if the connection name is undefined. If the connection is undefined, it indicates that it's not a supported connection.This can be achieved by changing this condition:
https://github.com/Expensify/App/blob/4f695c627e8d0125a3e9698255f5961039a318e0/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx#L283 to check for currentConnectionName instead of checking the length of policy?.connections, as this list could contain unsupported connections.
This change should also be applied here, here and here
OR
Instead of displaying undefined for unsupported connections, we can still retrieve the connection name regardless of whether it is supported, as Tom mentioned here .
To achieve this, we have two options:
- We can update the getCurrentConnectionName function so that it only checks
CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY, which contains both supported and unsupported connection names, and removeCONST.POLICY.CONNECTIONS.NAME:
function getCurrentConnectionName(policy?: Policy): string | undefined {
if (!policy?.connections) {
return undefined;
}
const connectionNames = CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY;
for (const key of Object.keys(connectionNames)) {
if (policy.connections[key]) {
return connectionNames[key];
}
}
return undefined;
}
- Or, we can create a new function that uses the same logic as above but with a different function name. This would help avoid potential issues elsewhere in the code. In this case, we need to update the function calls here , here , and here, here to use this new function. but i recommend to update the current function to keep everything consistent
- finally in the accounting page we need to show a message in case any of the current connections are unsupported so that the user can check it, to do that we need to add the following component here
{hasUnsupportedNDIntegration && !hasSyncError && (
<FormHelpMessage
isError
shouldShowRedDotIndicator
>
<Text style={[{color: theme.textError}]}>
{translate('workspace.accounting.unSupportedIntegration')}
<TextLink
onPress={() => {
Link.openOldDotLink(CONST.OLDDOT_URLS.POLICY_CONNECTIONS_URL(policyID));
}}
>
{translate('workspace.accounting.manageYourSettings')}
</TextLink>
</Text>
</FormHelpMessage>
)}
note: we might not need to warp it with FormHelpMessage as the user didn't make anything wrong ( the connection is not supported form our side), so it shouldn't be shown as error, we can just show the TextLink for without wrapping it.
Edited by proposal-police: This proposal was edited at 2024-09-24 09:51:46 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
- QBO - Category title link shows "undefined settings" when there is error with QBO connection
What is the root cause of that problem?
- We didn't handle the case there is a connection that is not supported in ND in: https://github.com/Expensify/App/blob/0c618acc8b5a0b77eb27dfa049a18e3135c51c52/src/libs/PolicyUtils.ts#L957 hence the link is displayed as "undefined setting".
What changes do you think we should make in order to solve the problem?
1. Display The categories below are imported from QuickBooks Desktop (or the name of the connected integration, even if it's not yet supported) to make the messaging consistent.
- First, change function:
https://github.com/Expensify/App/blob/740484c622ae1f56393c372741106b1af1d197dc/src/libs/PolicyUtils.ts#L952
function getCurrentConnectionName(policy: Policy | undefined, includeUnsupportedConnection = false): string | undefined {
const accountingIntegrations = Object.values(CONST.POLICY.CONNECTIONS.NAME);
if (includeUnsupportedConnection) {
accountingIntegrations.push(...Object.values(CONST.POLICY.UNSUPPORTED_CONNECTIONS.NAME));
}
const connectionKey = accountingIntegrations.find((integration) => !!policy?.connections?.[integration]);
return connectionKey ? CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionKey] : undefined;
}
By introducing a includeUnsupportedConnection param, we can make sure our change in this PR does not break other logics.
- Then, change logic: https://github.com/Expensify/App/blob/ace39e86b7f6a5015f1cc5722f8b739ff99ebab9/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx#L73
const currentConnectionName = PolicyUtils.getCurrentConnectionName(policy, true);
- Next, create
hasSyncErrorin: https://github.com/Expensify/App/blob/ace39e86b7f6a5015f1cc5722f8b739ff99ebab9/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx#L74
const [connectionSyncProgress] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CONNECTION_SYNC_PROGRESS}${policy?.id}`);
const isSyncInProgress = isConnectionInProgress(connectionSyncProgress, policy);
const hasSyncError = PolicyUtils.hasSyncError(policy, isSyncInProgress);
The text "The categories below are imported from your Quickbooks Desktop settings" should not be displayed if the connection encountered an error. We will use hasSyncError to decide whether we should display that text or not.
- (Optional) Next, update:
https://github.com/Expensify/App/blob/ace39e86b7f6a5015f1cc5722f8b739ff99ebab9/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx#L283
{!hasSyncError && isConnectedToAccounting ? (
- It will display something like:
If the connection is not supported and successful.
- And it will display something like:
if the connection is not supported and there is an error.
2. On the policy's accounting page, show the Go to Expensify Classic to manage your settings. text.
- We need to update the workspace accounting page to display the text "Go to Expensify Classic to manage your settings" in case "the connection is not supported and successful", since the case "the connection is not supported and there is an error" has already been implemented in another PR.
To do it, add another logic to handle that case to: https://github.com/Expensify/App/blob/1c39bd2bd896a573373b7ab357edc42e6ea48246/src/pages/workspace/accounting/PolicyAccountingPage.tsx#L495
{hasUnsupportedNDIntegration && !hasSyncError && (
<FormHelpMessage shouldShowRedDotIndicator={false}>
<Text>
<TextLink
onPress={() => {
// Go to Expensify Classic.
Link.openOldDotLink(CONST.OLDDOT_URLS.POLICY_CONNECTIONS_URL(policyID));
}}
>
{"Go to Expensify Classic to manage your settings"}
</TextLink>
</Text>
</FormHelpMessage>
)}
- Other minor changes can be implemented in PR stage, such as:
-
Remove
hasSyncErrorconditions in: https://github.com/Expensify/App/blob/1c39bd2bd896a573373b7ab357edc42e6ea48246/src/pages/workspace/accounting/PolicyAccountingPage.tsx#L462 -
Remove
!(hasUnsupportedNDIntegration && hasSyncError)in: https://github.com/Expensify/App/blob/1c39bd2bd896a573373b7ab357edc42e6ea48246/src/pages/workspace/accounting/PolicyAccountingPage.tsx#L380 -
Update
hasUnsupportedNDIntegrationvariable to:
const hasUnsupportedNDIntegration = !isEmptyObject(policy?.connections) && PolicyUtils.hasUnsupportedIntegration(policy, accountingIntegrations);
- It will display something like:
in case "the connection is not supported and successful".
What alternative solutions did you explore? (Optional)
Details
- We should change logic: https://github.com/Expensify/App/blob/ace39e86b7f6a5015f1cc5722f8b739ff99ebab9/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx#L283
{!hasSyncError && hasUnsupportedIntegration ? (
<Text>
<Text style={[styles.textNormal, styles.colorMuted]}>{`The categories below have been imported from the connection configured in `}</Text>
<TextLink
style={[styles.textNormal, styles.link]}
onPress={() => {
// Go to Expensify Classic.
Link.openOldDotLink(CONST.OLDDOT_URLS.POLICY_CONNECTIONS_URL(policyId));
}}
>
{`Expensify Classic`}
</TextLink>
<Text style={[styles.textNormal, styles.colorMuted]}>.</Text>
</Text>
) : !hasSyncError && isConnectedToAccounting ? (
in there hasUnsupportedIntegration is
const hasUnsupportedIntegration = isConnectedToAccounting && PolicyUtils.hasUnsupportedIntegration(policy, Object.values(CONST.POLICY.CONNECTIONS.NAME));
and hasSyncError is
const [connectionSyncProgress] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CONNECTION_SYNC_PROGRESS}${policy?.id}`);
const isSyncInProgress = isConnectionInProgress(connectionSyncProgress, policy);
const hasSyncError = PolicyUtils.hasSyncError(policy, isSyncInProgress);
- It will display something like:
if there is a successful connection which is not supported in ND and when user clicks on "Expensify Classic", it will open OD app like we did in:
https://github.com/Expensify/App/blob/f7a4aa13979ae71631df79a6ac181c2e9b08f17f/src/pages/workspace/accounting/PolicyAccountingPage.tsx#L491
- We should apply the same fix in tag, reportField, taxes page.
Job added to Upwork: https://www.upwork.com/jobs/~021837252793117015940
Triggered auto assignment to Contributor-plus team member for initial proposal review - @brunovjk (External)
@brunovjk when you get a chance, can you please review the proposals? Thanks!
@brunovjk when you get a chance, can you please review the proposals? Thanks!
Sure!
I don't think QBD is implemented at all. cc @lakchote @dylanexpensify
Appreciate the insights @shubham1206agra! I will hold off on the proposal review until the last comment has been addressed :D
While adding QuickBooks Desktop (QBD) would resolve the issue for that connection, this "undefined settings" error may still occur with other unsupported connections. To ensure broader coverage and prevent similar issues, I recommend considering the alternative solution proposed, which addresses undefined connections more comprehensively.
I'm confused, this GH is about QBO, not QBD. Why did we pivot to talk about QBD?
I don't understand why we're talking about QBD either here. We're talking about QBO. QBD is not yet implemented in NewDot.
@lakchote The QBD is not yet implemented in NewDot. But there are a few cases where the QBD term is still displayed in ND, such as our current issue and that issue.
It seems the confusion stems from the fact that this issue was initially labeled as QBO, but the actual functionality being tested in the video and steps involves QBD (QuickBooks Desktop), not QBO (QuickBooks Online).
Here's a summary:
- The issue creator referenced QBO Desktop, but the test steps, video, and setup involve QBD only.
- The PR addresses handling non-configurable integrations in NewDot like QuickBooks Desktop (QBD).
- The video shows a QBD flow (connecting to QBD on OldDot, followed by accessing categories in NewDot).
POC
https://github.com/user-attachments/assets/f36728c8-7009-4378-93ed-f1fc9de6ff6b
I reviewed both proposals (using the alternative solution from the first one), and they are quite similar. While the first proposal from @abzokhattab suggests "avoiding the display of the 'categories below are imported from...' message if the connection name is undefined," I believe the second one from @mkzie2 —which involves adding a message informing the user that certain features like QBD categories and tags are not yet supported—is more appropriate, provided that this issue is confirmed.
@alexpensify @lakchote @shubham1206agra @IuliiaHerets Does this make sense or am I missing something? Thank you :D
I have a question: if the connection setup fails, will the categories still be imported from the failed connection?
If not, I think it makes sense not to display that label here .
Instead, we could add another label warning the user to check the connection page for a potential failed connection, rather than informing them that the categories were imported
It does make sense @brunovjk, thanks!
The issue's title is misleading, it's indeed about QBD and not QBO cc @IuliiaHerets
QBD in NewDot will soon be supported, and is already supported in OldDot.
Regarding what to do between these 2 choices:
- avoiding the display of the
categories below are imported from...message if the connection name isundefined - adding a message informing the user that certain features like QBD categories and tags are not yet supported
I'd go with helping the user by informing him on the current status of the integration. If it failed to connect, use a specific message. If it's not supported yet, do the same.
I'm going to tag @JmillsExpensify @trjExpensify what would you go with?
QBD in NewDot will soon be supported, and is already supported in OldDot.
How far away are we from building QBD workspace settings out in NewDot? I'm a bit mindful of investing in throwaway work with QBD coming soon. That said, we could hit the "undefined" message with Certina (FinancialForce) as well I guess which is a little further out - but not a million miles away.
Can't we know from the policy object which accounting solution is connected to the workspace already, and show it's name instead of undefined on the categories and tags page here like normal?
Then on the accounting page replace this message with a generic _"Go to Expensify Classic to manage your <notYetSupportedConnectionName> settings." which we'll remove in turn for QBD and Certina as those are built:
How far away are we from building QBD workspace settings out in NewDot? I'm a bit mindful of investing in throwaway work with QBD coming soon. That said, we could hit the "undefined" message with Certina (FinancialForce) as well I guess which is a little further out - but not a million miles away.
That's a fair concern. QBD should start to be implemented by the end of the month/early October. We could do this in advance yes, as it can impact other integrations down the line if they're not supported.
Can't we know from the policy object which accounting solution is connected to the workspace already, and show it's name instead of undefined on the categories and tags page here like normal? Yes, we can.
What you suggest make sense:
- Display
The categories below are imported from QuickBooks Desktop(or the name of the connected integration, even if it's not yet supported) to make the messaging consistent. - On the policy's accounting page, show the
Go to Expensify Classic to manage your settings.text.
Proposal Updated
Updated my alternative solution to show the correct connection name regardless of whether the connection is supported or not
Proposal updated
- Based on:
Display The categories below are imported from QuickBooks Desktop (or the name of the connected integration, even if it's not yet supported) to make the messaging consistent. On the policy's accounting page, show the Go to Expensify Classic to manage your settings. text.
I updated the main solution
I will review it later today.
I liked the update from @abzokhattab's proposal for its simplicity, I tested it and it solves our main issue.
I did a quick test on the app with those changes and didn't came across any issue, @abzokhattab you commented "Or, we can create a new function that uses the same logic as above but with a different function name. This would help avoid potential issues elsewhere in the code.", did you find anything in your tests? Also @abzokhattab your proposal is incomplete, it needs to be taken into consideration with the second comment from trjExpensify here: "Then on the accounting page replace this message with a generic "Go to Expensify Classic to manage your settings." which we'll remove in turn for QBD and Certina as those are built:"
@mkzie2 's proposal also seems ok, more robust, but I'm afraid it's bit over-engineered. @mkzie2 Correct me if I'm wrong, but I didn't see that we should "The text "The categories below are imported from your Quickbooks Desktop settings" should not be displayed if the connection encountered an error" as mentioned in your proposal.
did you find anything in your tests?
I have checked that deeply now and i think we can safely modify the existing method instead of creating another one or modifying the existing one by adding a new arg
needs to be taken into consideration with the second comment from
Updated the proposal to handle this point
I didn't see that we should "The text "The categories below are imported from your Quickbooks Desktop settings" should not be displayed if the connection encountered an error" as mentioned in your proposal.
- I have noted on my proposal that this is optional.
I'm afraid it's bit over-engineered
- I don't see any over-engineered in my proposal. Can you give me more detail?
Display The categories below are imported from QuickBooks Desktop (or the name of the connected integration, even if it's not yet supported) to make the messaging consistent. On the policy's accounting page, show the Go to Expensify Classic to manage your settings. text.
- The important is that my proposal matches these two requirements.
Thank you both for the updates and hard work. I appreciate the thoughtful approaches and carefully reviewed both proposals.
@abzokhattab: Although I like to look for the simplest solution, your proposal feels incomplete: It’s unclear how it handles scenarios like successful vs. failed connections.
@mkzie2: Apologies for my earlier wording—I wasn’t suggesting your solution was over-engineered, I was concern about not to do it. After a closer look, I see it’s robust, handling both current and future integrations well. I also liked the use of hasSyncError for clearer user messaging.
I think we can move forward with @mkzie2's proposal, but I’d love that @justinpersaud take a look at the proposal and share their thoughts before moving on. Thank you.
🎀👀🎀 C+ reviewed
Triggered auto assignment to @justinpersaud, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Sounds good to me!
📣 @brunovjk 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑💻 Keep in mind: Code of Conduct | Contributing 📖