aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/instant/src/redux/analytics_middleware.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/instant/src/redux/analytics_middleware.ts b/packages/instant/src/redux/analytics_middleware.ts
index 2b3ebf529..eddeeb193 100644
--- a/packages/instant/src/redux/analytics_middleware.ts
+++ b/packages/instant/src/redux/analytics_middleware.ts
@@ -12,11 +12,13 @@ import { State } from './reducer';
export const analyticsMiddleware: Middleware = store => next => middlewareAction => {
const prevState = store.getState() as State;
+ const prevAccount = prevState.providerState.account;
+
const nextAction = next(middlewareAction) as Action;
- const nextState = store.getState() as State;
- const curAccount = nextState.providerState.account;
- const prevAccount = prevState.providerState.account;
+ const curState = store.getState() as State;
+ const curAccount = curState.providerState.account;
+
switch (nextAction.type) {
case ActionTypes.SET_ACCOUNT_STATE_READY:
if (curAccount.state === AccountState.Ready && !_.isEqual(curAccount, prevAccount)) {