diff --git a/js/src/redux/providers/balances.js b/js/src/redux/providers/balances.js index 0a73ef4f9..8d46e42d2 100644 --- a/js/src/redux/providers/balances.js +++ b/js/src/redux/providers/balances.js @@ -86,7 +86,7 @@ export default class Balances { // If syncing, only retrieve balances once every // few seconds if (syncing) { - this.shortThrottledFetch(); + this.shortThrottledFetch.cancel(); return this.longThrottledFetch(); } diff --git a/js/src/redux/providers/balancesActions.js b/js/src/redux/providers/balancesActions.js index d90cab678..56a2ebafd 100644 --- a/js/src/redux/providers/balancesActions.js +++ b/js/src/redux/providers/balancesActions.js @@ -173,18 +173,15 @@ export function fetchTokens (_tokenIds) { export function fetchBalances (_addresses) { return (dispatch, getState) => { const { api, personal } = getState(); - const { visibleAccounts, accountsInfo } = personal; + const { visibleAccounts, accounts } = personal; - const addresses = uniq((_addresses || visibleAccounts || []).concat(Object.keys(accountsInfo))); - - if (addresses.length === 0) { - return Promise.resolve(); - } + const addresses = uniq(_addresses || visibleAccounts || []); // With only a single account, more info will be displayed. const fullFetch = addresses.length === 1; - const addressesToFetch = uniq(addresses); + // Add accounts addresses (for notifications, accounts selection, etc.) + const addressesToFetch = uniq(addresses.concat(Object.keys(accounts))); return Promise .all(addressesToFetch.map((addr) => fetchAccount(addr, api, fullFetch))) diff --git a/js/src/redux/providers/certifications/middleware.js b/js/src/redux/providers/certifications/middleware.js index c81aa7e67..498c1cb93 100644 --- a/js/src/redux/providers/certifications/middleware.js +++ b/js/src/redux/providers/certifications/middleware.js @@ -218,6 +218,7 @@ export default class CertificationsMiddleware { const _addresses = action.addresses || []; addresses = uniq(addresses.concat(_addresses)); fetchConfirmedEvents(); + next(action); break; default: diff --git a/js/src/redux/providers/personalActions.js b/js/src/redux/providers/personalActions.js index 1ed39c05a..5d91aeef8 100644 --- a/js/src/redux/providers/personalActions.js +++ b/js/src/redux/providers/personalActions.js @@ -122,7 +122,7 @@ export function setVisibleAccounts (addresses) { return; } - dispatch(fetchBalances(addresses)); dispatch(_setVisibleAccounts(addresses)); + dispatch(fetchBalances(addresses)); }; } diff --git a/js/src/redux/providers/personalReducer.js b/js/src/redux/providers/personalReducer.js index daadd54b3..b6cd051a4 100644 --- a/js/src/redux/providers/personalReducer.js +++ b/js/src/redux/providers/personalReducer.js @@ -47,7 +47,7 @@ export default handleActions({ setVisibleAccounts (state, action) { const addresses = (action.addresses || []).sort(); - if (isEqual(addresses, state.addresses)) { + if (isEqual(addresses, state.visibleAccounts)) { return state; }