mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-28 18:40:34 -05:00
Fix issue where the UI is stuck sync'ing if no data from server (#3941)
* Fix issue where the UI is stuck sync'ing if no data from server * add release note
This commit is contained in:
@@ -205,6 +205,9 @@ async function downloadSimpleFinTransactions(
|
||||
60000,
|
||||
);
|
||||
|
||||
if (Object.keys(res).length === 0) {
|
||||
throw BankSyncError('NO_DATA', 'NO_DATA');
|
||||
}
|
||||
if (res.error_code) {
|
||||
throw BankSyncError(res.error_type, res.error_code);
|
||||
}
|
||||
|
||||
@@ -1168,46 +1168,62 @@ handlers['simplefin-batch-sync'] = async function ({ ids = [] }) {
|
||||
true,
|
||||
);
|
||||
|
||||
console.group('Bank Sync operation for all SimpleFin accounts');
|
||||
const res = await bankSync.SimpleFinBatchSync(
|
||||
accounts.map(a => ({
|
||||
id: a.id,
|
||||
accountId: a.account_id,
|
||||
})),
|
||||
);
|
||||
|
||||
const retVal = [];
|
||||
for (const account of res) {
|
||||
const errors = [];
|
||||
const newTransactions = [];
|
||||
const matchedTransactions = [];
|
||||
const updatedAccounts = [];
|
||||
|
||||
if (account.res.error_code) {
|
||||
errors.push(
|
||||
handleSyncError(
|
||||
{
|
||||
type: 'BankSyncError',
|
||||
category: account.res.error_type,
|
||||
code: account.res.error_code,
|
||||
},
|
||||
console.group('Bank Sync operation for all SimpleFin accounts');
|
||||
try {
|
||||
const res = await bankSync.SimpleFinBatchSync(
|
||||
accounts.map(a => ({
|
||||
id: a.id,
|
||||
accountId: a.account_id,
|
||||
})),
|
||||
);
|
||||
for (const account of res) {
|
||||
const errors = [];
|
||||
const newTransactions = [];
|
||||
const matchedTransactions = [];
|
||||
const updatedAccounts = [];
|
||||
|
||||
if (account.res.error_code) {
|
||||
errors.push(
|
||||
handleSyncError(
|
||||
{
|
||||
type: 'BankSyncError',
|
||||
category: account.res.error_type,
|
||||
code: account.res.error_code,
|
||||
},
|
||||
accounts.find(a => a.id === account.accountId),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
handleSyncResponse(
|
||||
account.res,
|
||||
accounts.find(a => a.id === account.accountId),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
handleSyncResponse(
|
||||
account.res,
|
||||
accounts.find(a => a.id === account.accountId),
|
||||
newTransactions,
|
||||
matchedTransactions,
|
||||
updatedAccounts,
|
||||
);
|
||||
}
|
||||
newTransactions,
|
||||
matchedTransactions,
|
||||
updatedAccounts,
|
||||
);
|
||||
}
|
||||
|
||||
retVal.push({
|
||||
accountId: account.accountId,
|
||||
res: { errors, newTransactions, matchedTransactions, updatedAccounts },
|
||||
});
|
||||
retVal.push({
|
||||
accountId: account.accountId,
|
||||
res: { errors, newTransactions, matchedTransactions, updatedAccounts },
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
const errors = [];
|
||||
for (const account of accounts) {
|
||||
retVal.push({
|
||||
accountId: account.accountId,
|
||||
res: {
|
||||
errors,
|
||||
newTransactions: [],
|
||||
matchedTransactions: [],
|
||||
updatedAccounts: [],
|
||||
},
|
||||
});
|
||||
errors.push(handleSyncError(err, account));
|
||||
}
|
||||
}
|
||||
|
||||
if (retVal.some(a => a.res.updatedAccounts.length > 0)) {
|
||||
|
||||
6
upcoming-release-notes/3941.md
Normal file
6
upcoming-release-notes/3941.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Bugfix
|
||||
authors: [psybers]
|
||||
---
|
||||
|
||||
Fix UI issue with bank sync being stuck if no data from server.
|
||||
Reference in New Issue
Block a user