From ed26f5af985239e0dd91b68d4ec0aa264267acd6 Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Thu, 15 Nov 2018 13:54:35 -0800 Subject: Move variable assignments around to be more clear --- packages/instant/src/redux/analytics_middleware.ts | 8 +++++--- 1 file 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)) { -- cgit