diff --git a/src/actions/TrezorConnectActions.js b/src/actions/TrezorConnectActions.js index e67d6927..85d03cf3 100644 --- a/src/actions/TrezorConnectActions.js +++ b/src/actions/TrezorConnectActions.js @@ -237,7 +237,7 @@ export const deviceDisconnect = (device: Device): AsyncAction => async (dispatch if (device.features) { const instances = getState().devices.filter(d => d.features && device.features && d.state && !d.remember && d.features.device_id === device.features.device_id); if (instances.length > 0) { - const isSelected = deviceUtils.isSelectedDevice(getState().wallet.selectedDevice, instances[0]); + const isSelected = deviceUtils.isSelectedDevice(getState().wallet.selectedDevice, device); if (!isSelected && getState().modal.context !== CONTEXT_NONE) { dispatch({ type: CONNECT.FORGET_SILENT, diff --git a/src/utils/device.js b/src/utils/device.js index 94924325..8bf3a368 100644 --- a/src/utils/device.js +++ b/src/utils/device.js @@ -2,6 +2,7 @@ import colors from 'config/colors'; +import type { Device } from 'trezor-connect'; import type { TrezorDevice, State, @@ -91,7 +92,7 @@ export const isDeviceAccessible = (device: ?TrezorDevice): boolean => { return device.mode === 'normal' && device.firmware !== 'required'; }; -export const isSelectedDevice = (current: ?TrezorDevice, device: ?TrezorDevice): boolean => !!((current && device && (current.path === device.path && current.instance === device.instance))); +export const isSelectedDevice = (selected: ?TrezorDevice, device: ?(TrezorDevice | Device)): boolean => !!((selected && device && (selected.path === device.path && (device.ts && selected.instance === device.instance)))); export const getVersion = (device: TrezorDevice): string => { let version;