aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant
diff options
context:
space:
mode:
Diffstat (limited to 'packages/instant')
-rw-r--r--packages/instant/src/redux/async_data.ts6
-rw-r--r--packages/instant/src/redux/reducer.ts11
2 files changed, 11 insertions, 6 deletions
diff --git a/packages/instant/src/redux/async_data.ts b/packages/instant/src/redux/async_data.ts
index 8999ef097..2682677b9 100644
--- a/packages/instant/src/redux/async_data.ts
+++ b/packages/instant/src/redux/async_data.ts
@@ -72,9 +72,9 @@ export const asyncData = {
fetchAccountBalanceAndDispatchToStore: async (providerState: ProviderState, dispatch: Dispatch) => {
const web3Wrapper = providerState.web3Wrapper;
const account = providerState.account;
- if (account.state !== AccountState.Ready) {
- return;
- }
+ // if (account.state !== AccountState.Ready) {
+ // return;
+ // }
try {
const address = account.address;
const ethBalanceInWei = await web3Wrapper.getBalanceInWeiAsync(address);
diff --git a/packages/instant/src/redux/reducer.ts b/packages/instant/src/redux/reducer.ts
index 4688250bc..28f094184 100644
--- a/packages/instant/src/redux/reducer.ts
+++ b/packages/instant/src/redux/reducer.ts
@@ -73,11 +73,16 @@ export const createReducer = (initialState: State) => {
case ActionTypes.SET_ACCOUNT_STATE_LOCKED:
return reduceStateWithAccount(state, LOCKED_ACCOUNT);
case ActionTypes.SET_ACCOUNT_STATE_READY: {
- const account: AccountReady = {
+ const address = action.data;
+ const newAccount: AccountReady = {
state: AccountState.Ready,
- address: action.data,
+ address,
};
- return reduceStateWithAccount(state, account);
+ const currentAccount = state.providerState.account;
+ if (currentAccount.state === AccountState.Ready && currentAccount.address === address) {
+ newAccount.ethBalanceInWei = currentAccount.ethBalanceInWei;
+ }
+ return reduceStateWithAccount(state, newAccount);
}
case ActionTypes.UPDATE_ACCOUNT_ETH_BALANCE: {
const { address, ethBalanceInWei } = action.data;