diff --git a/src/actions/WalletActions.js b/src/actions/WalletActions.js index 98037319..f8d8765f 100644 --- a/src/actions/WalletActions.js +++ b/src/actions/WalletActions.js @@ -23,7 +23,7 @@ export type WalletAction = | { type: typeof WALLET.SET_INITIAL_URL, state?: RouterLocationState, - pathname?: ?string, + pathname?: string, } | { type: typeof WALLET.TOGGLE_DEVICE_DROPDOWN, diff --git a/src/services/WalletService.js b/src/services/WalletService.js index 6c57b8d2..e0dc6a60 100644 --- a/src/services/WalletService.js +++ b/src/services/WalletService.js @@ -32,12 +32,13 @@ const WalletService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa // exclude landing page url const { pathname } = action.payload.location; const isValidPath = !api.dispatch(RouterActions.isLandingPageUrl(pathname, true)); - api.dispatch({ - type: WALLET.SET_INITIAL_URL, - pathname: isValidPath ? pathname : null, - state: {}, - }); - + if (isValidPath) { + api.dispatch({ + type: WALLET.SET_INITIAL_URL, + pathname, + state: {}, + }); + } // pass action and break process return next(action); } @@ -46,10 +47,8 @@ const WalletService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa next(action); switch (action.type) { - case WALLET.SET_INITIAL_URL: - if (action.hasOwnProperty('pathname')) { - api.dispatch(LocalStorageActions.loadData()); - } + case WALLET.SET_FIRST_LOCATION_CHANGE: + api.dispatch(LocalStorageActions.loadData()); break; case WALLET.SET_SELECTED_DEVICE: // try to authorize device