diff --git a/src/actions/RouterActions.js b/src/actions/RouterActions.js index d4c5842b..18eae118 100644 --- a/src/actions/RouterActions.js +++ b/src/actions/RouterActions.js @@ -2,6 +2,7 @@ import { push, LOCATION_CHANGE } from 'react-router-redux'; import { CONTEXT_NONE } from 'actions/constants/modal'; +import { SET_INITIAL_URL } from 'actions/constants/wallet'; import { routes } from 'support/routes'; import * as deviceUtils from 'utils/device'; @@ -57,7 +58,7 @@ export const paramsValidation = (params: RouterLocationState): PayloadAction d.features && d.features.device_id === params.device && d.instance === parseInt(params.deviceInstance, 10)); } else { - device = devices.find(d => d.path === params.device || (d.features && d.features.device_id === params.device)); + device = devices.find(d => ((!d.features || d.mode === 'bootloader') && d.path === params.device) || (d.features && d.features.device_id === params.device)); } if (!device) return false; @@ -247,6 +248,8 @@ const sortDevices = (devices: Array): Array => devic * Redirect to requested device */ export const selectDevice = (device: TrezorDevice | Device): ThunkAction => (dispatch: Dispatch, getState: GetState): void => { + if (dispatch(setInitialUrl())) return; + const url: ?string = dispatch(getDeviceUrl(device)); if (!url) return; @@ -352,7 +355,12 @@ export const setInitialUrl = (): PayloadAction => (dispatch: Dispatch, state: {}, }, })); + if (valid === initialPathname) { + // reset initial url + dispatch({ + type: SET_INITIAL_URL, + }); dispatch(goto(valid)); return true; } diff --git a/src/services/WalletService.js b/src/services/WalletService.js index 597f1b3c..2ad40df0 100644 --- a/src/services/WalletService.js +++ b/src/services/WalletService.js @@ -47,7 +47,9 @@ const WalletService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa switch (action.type) { case WALLET.SET_INITIAL_URL: - api.dispatch(LocalStorageActions.loadData()); + if (action.pathname) { + api.dispatch(LocalStorageActions.loadData()); + } break; case WALLET.SET_SELECTED_DEVICE: // try to authorize device