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:
parent
badf140006
commit
2d4f3e8232
@ -206,7 +206,7 @@ export const getSelectedDeviceState = (): AsyncAction => async (dispatch: Dispat
|
|||||||
export const deviceDisconnect = (device: Device): AsyncAction => async (dispatch: Dispatch, getState: GetState): Promise<void> => {
|
export const deviceDisconnect = (device: Device): AsyncAction => async (dispatch: Dispatch, getState: GetState): Promise<void> => {
|
||||||
const selected: ?TrezorDevice = getState().wallet.selectedDevice;
|
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) {
|
if (selected && selected.features && selected.features.device_id === device.features.device_id) {
|
||||||
dispatch(DiscoveryActions.stop(selected));
|
dispatch(DiscoveryActions.stop(selected));
|
||||||
}
|
}
|
||||||
@ -218,7 +218,11 @@ export const deviceDisconnect = (device: Device): AsyncAction => async (dispatch
|
|||||||
device: instances[0],
|
device: instances[0],
|
||||||
instances,
|
instances,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
dispatch(RouterActions.selectFirstAvailableDevice());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
dispatch(RouterActions.selectFirstAvailableDevice());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user