1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-24 09:18:09 +00:00

fixed edgecase: handle disconnect device in BL/initialized mode OR without features

This commit is contained in:
Szymon Lesisz 2018-10-01 13:21:58 +02:00
parent badf140006
commit 2d4f3e8232

View File

@ -206,7 +206,7 @@ export const getSelectedDeviceState = (): AsyncAction => async (dispatch: Dispat
export const deviceDisconnect = (device: Device): AsyncAction => async (dispatch: Dispatch, getState: GetState): Promise<void> => {
const selected: ?TrezorDevice = getState().wallet.selectedDevice;
if (device && device.features) {
if (device.features) {
if (selected && selected.features && selected.features.device_id === device.features.device_id) {
dispatch(DiscoveryActions.stop(selected));
}
@ -218,7 +218,11 @@ export const deviceDisconnect = (device: Device): AsyncAction => async (dispatch
device: instances[0],
instances,
});
} else {
dispatch(RouterActions.selectFirstAvailableDevice());
}
} else {
dispatch(RouterActions.selectFirstAvailableDevice());
}
};