Skip to content
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

[Wave Collect] [Xero] Fix: When you click “Sync now” you see the Quickbooks Online text very briefly #42383

Merged
merged 3 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1777,7 +1777,8 @@ const CONST = {
XERO: 'xero',
},
SYNC_STAGE_NAME: {
STARTING_IMPORT: 'startingImport',
STARTING_IMPORT_QBO: 'startingImportQBO',
STARTING_IMPORT_XERO: 'startingImportXero',
QBO_IMPORT_MAIN: 'quickbooksOnlineImportMain',
QBO_IMPORT_CUSTOMERS: 'quickbooksOnlineImportCustomers',
QBO_IMPORT_EMPLOYEES: 'quickbooksOnlineImportEmployees',
Expand Down
4 changes: 3 additions & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2396,7 +2396,9 @@ export default {
return 'Checking QuickBooks Online connection';
case 'quickbooksOnlineImportMain':
return 'Importing your QuickBooks Online data';
case 'startingImport':
case 'startingImportXero':
return 'Importing your Xero data';
case 'startingImportQBO':
return 'Importing your QuickBooks Online data';
case 'quickbooksOnlineSyncTitle':
return 'Synchronizing QuickBooks Online data';
Expand Down
4 changes: 3 additions & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2400,7 +2400,9 @@ export default {
return 'Revisando conexión a QuickBooks Online';
case 'quickbooksOnlineImportMain':
return 'Importando datos desde QuickBooks Online';
case 'startingImport':
case 'startingImportXero':
return 'Importando datos desde Xero';
case 'startingImportQBO':
return 'Importando datos desde QuickBooks Online';
case 'quickbooksOnlineSyncTitle':
return 'Sincronizando datos desde QuickBooks Online';
Expand Down
24 changes: 12 additions & 12 deletions src/libs/actions/connections/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,13 @@ function updatePolicyConnectionConfig<TConnectionName extends ConnectionName, TS
* @param connectionName - Name of the connection, QBO/Xero
*/
function syncConnection(policyID: string, connectionName: PolicyConnectionName | undefined) {
const isQBOConnection = connectionName === CONST.POLICY.CONNECTIONS.NAME.QBO;
const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY_CONNECTION_SYNC_PROGRESS}${policyID}`,
value: {
stageInProgress: CONST.POLICY.CONNECTIONS.SYNC_STAGE_NAME.STARTING_IMPORT,
stageInProgress: isQBOConnection ? CONST.POLICY.CONNECTIONS.SYNC_STAGE_NAME.STARTING_IMPORT_QBO : CONST.POLICY.CONNECTIONS.SYNC_STAGE_NAME.STARTING_IMPORT_XERO,
connectionName,
},
},
Expand All @@ -146,18 +147,17 @@ function syncConnection(policyID: string, connectionName: PolicyConnectionName |
},
];

const parameters: SyncPolicyToQuickbooksOnlineParams | SyncPolicyToXeroParams =
connectionName === CONST.POLICY.CONNECTIONS.NAME.QBO
? ({
policyID,
idempotencyKey: policyID,
} as SyncPolicyToQuickbooksOnlineParams)
: ({
policyID,
idempotencyKey: policyID,
} as SyncPolicyToXeroParams);
const parameters: SyncPolicyToQuickbooksOnlineParams | SyncPolicyToXeroParams = isQBOConnection
? ({
policyID,
idempotencyKey: policyID,
} as SyncPolicyToQuickbooksOnlineParams)
: ({
policyID,
idempotencyKey: policyID,
} as SyncPolicyToXeroParams);

API.read(connectionName === CONST.POLICY.CONNECTIONS.NAME.QBO ? READ_COMMANDS.SYNC_POLICY_TO_QUICKBOOKS_ONLINE : READ_COMMANDS.SYNC_POLICY_TO_XERO, parameters, {
API.read(isQBOConnection ? READ_COMMANDS.SYNC_POLICY_TO_QUICKBOOKS_ONLINE : READ_COMMANDS.SYNC_POLICY_TO_XERO, parameters, {
optimisticData,
failureData,
});
Expand Down
Loading