fix selectFirstAvailableDevice

Redirect only if first available device is not currently selected
fix #117
pull/118/head
Szymon Lesisz 6 years ago
parent 9a8ac01dcd
commit c3c3c10350

@ -250,10 +250,14 @@ export const selectDevice = (device: TrezorDevice | Device): ThunkAction => (dis
/* /*
* Redirect to first device or landing page * Redirect to first device or landing page
*/ */
export const selectFirstAvailableDevice = (): ThunkAction => (dispatch: Dispatch): void => { export const selectFirstAvailableDevice = (): ThunkAction => (dispatch: Dispatch, getState: GetState): void => {
const url = dispatch(getFirstAvailableDeviceUrl()); const url = dispatch(getFirstAvailableDeviceUrl());
if (url) { if (url) {
dispatch(goto(url)); const currentParams = getState().router.location.state;
const requestedParams = dispatch(pathToParams(url));
if (currentParams.device !== requestedParams.device || currentParams.deviceInstance !== requestedParams.deviceInstance) {
dispatch(goto(url));
}
} else { } else {
dispatch(gotoLandingPage()); dispatch(gotoLandingPage());
} }

Loading…
Cancel
Save