From ed26f5af985239e0dd91b68d4ec0aa264267acd6 Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Thu, 15 Nov 2018 13:54:35 -0800 Subject: [PATCH] Move variable assignments around to be more clear --- packages/instant/src/redux/analytics_middleware.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/instant/src/redux/analytics_middleware.ts b/packages/instant/src/redux/analytics_middleware.ts index 2b3ebf5294..eddeeb1933 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 nextAction = next(middlewareAction) as Action; - const nextState = store.getState() as State; - - const curAccount = nextState.providerState.account; const prevAccount = prevState.providerState.account; + + const nextAction = next(middlewareAction) as Action; + + 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)) {