diff --git a/test/unit/actions/tx_test.js b/test/unit/actions/tx_test.js index 427b806fd..d9f9f86d4 100644 --- a/test/unit/actions/tx_test.js +++ b/test/unit/actions/tx_test.js @@ -35,7 +35,7 @@ describe('tx confirmation screen', function () { cb() }, getState (cb) { - cb() + cb(null, {}) }, }) diff --git a/ui/app/store/actions.js b/ui/app/store/actions.js index afcdbc274..dcb7dca2d 100644 --- a/ui/app/store/actions.js +++ b/ui/app/store/actions.js @@ -1086,9 +1086,20 @@ export function unlockSucceeded (message) { } export function updateMetamaskState (newState) { - return { - type: actionConstants.UPDATE_METAMASK_STATE, - value: newState, + return (dispatch, getState) => { + const { metamask: currentState } = getState() + + const { currentLocale } = currentState + const { currentLocale: newLocale } = newState + + if (currentLocale && newLocale && currentLocale !== newLocale) { + dispatch(updateCurrentLocale(newLocale)) + } + + dispatch({ + type: actionConstants.UPDATE_METAMASK_STATE, + value: newState, + }) } } diff --git a/ui/index.js b/ui/index.js index 03e41727d..453f128cf 100644 --- a/ui/index.js +++ b/ui/index.js @@ -76,14 +76,6 @@ async function startApp (metamaskState, backgroundConnection, opts) { } backgroundConnection.on('update', function (metamaskState) { - const currentState = store.getState() - const { currentLocale } = currentState.metamask - const { currentLocale: newLocale } = metamaskState - - if (currentLocale && newLocale && currentLocale !== newLocale) { - store.dispatch(actions.updateCurrentLocale(newLocale)) - } - store.dispatch(actions.updateMetamaskState(metamaskState)) })