diff --git a/src/actions/RouterActions.js b/src/actions/RouterActions.js index 4b7ad51c..603bbb01 100644 --- a/src/actions/RouterActions.js +++ b/src/actions/RouterActions.js @@ -434,7 +434,6 @@ export const setInitialUrl = (): PayloadAction => ( // DEVICE.CONNECT race condition, "selectDevice" method was called but currently selectedDevice is in getState (auth) process // if so, consume this action (return true) to break "selectDevice" process - // "setInitialUrl" will be called again after AUTH_DEVICE action const { selectedDevice } = getState().wallet; if ( selectedDevice && diff --git a/src/services/WalletService.js b/src/services/WalletService.js index 5d0a75d9..6c57b8d2 100644 --- a/src/services/WalletService.js +++ b/src/services/WalletService.js @@ -32,13 +32,12 @@ const WalletService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa // exclude landing page url const { pathname } = action.payload.location; const isValidPath = !api.dispatch(RouterActions.isLandingPageUrl(pathname, true)); - if (isValidPath) { - api.dispatch({ - type: WALLET.SET_INITIAL_URL, - pathname: action.payload.location.pathname, - state: {}, - }); - } + api.dispatch({ + type: WALLET.SET_INITIAL_URL, + pathname: isValidPath ? pathname : null, + state: {}, + }); + // pass action and break process return next(action); } @@ -48,7 +47,7 @@ const WalletService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa switch (action.type) { case WALLET.SET_INITIAL_URL: - if (action.pathname) { + if (action.hasOwnProperty('pathname')) { api.dispatch(LocalStorageActions.loadData()); } break;