diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-16 05:54:35 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-16 05:54:35 +0800 |
commit | ed26f5af985239e0dd91b68d4ec0aa264267acd6 (patch) | |
tree | e395d4731e466d879adfccf39f1887d5d1cf6ad8 | |
parent | 71aeb7cddcd2a1faf7a4dc46d828ad8471019f37 (diff) | |
download | dexon-sol-tools-ed26f5af985239e0dd91b68d4ec0aa264267acd6.tar dexon-sol-tools-ed26f5af985239e0dd91b68d4ec0aa264267acd6.tar.gz dexon-sol-tools-ed26f5af985239e0dd91b68d4ec0aa264267acd6.tar.bz2 dexon-sol-tools-ed26f5af985239e0dd91b68d4ec0aa264267acd6.tar.lz dexon-sol-tools-ed26f5af985239e0dd91b68d4ec0aa264267acd6.tar.xz dexon-sol-tools-ed26f5af985239e0dd91b68d4ec0aa264267acd6.tar.zst dexon-sol-tools-ed26f5af985239e0dd91b68d4ec0aa264267acd6.zip |
Move variable assignments around to be more clear
-rw-r--r-- | packages/instant/src/redux/analytics_middleware.ts | 8 |
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)) { |