Skip to content

Commit

Permalink
Wait for wallet init before fetching history (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
pinheadmz committed May 18, 2020
1 parent 159ee32 commit 6b15a2c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/ducks/node.js
@@ -1,5 +1,5 @@
import { clientStub } from '../background/node/client';
import { getNetwork, setNetwork } from '../db/system';
import { getNetwork, setNetwork, getInitializationState } from '../db/system';
import { fetchWallet, fetchTransactions } from './walletActions';
import { getWatching } from './watching';
import * as logger from '../utils/logClient';
Expand Down Expand Up @@ -40,9 +40,11 @@ export const start = (network) => async (dispatch, getState) => {
});
await dispatch(setNodeInfo());
await dispatch(fetchWallet());
await dispatch(fetchTransactions());
await dispatch(getWatching(network));
await dispatch(onNewBlock());
if (await getInitializationState(network)) {
await dispatch(fetchTransactions());
await dispatch(getWatching(network));
await dispatch(onNewBlock());
}
} catch (error) {
dispatch({
type: START_ERROR,
Expand Down

0 comments on commit 6b15a2c

Please sign in to comment.