From bc39e72fd920171e37c5e9a7341a286bc8c5b861 Mon Sep 17 00:00:00 2001 From: Anton Nikolaev Date: Tue, 29 Sep 2020 04:25:01 -0700 Subject: [PATCH] Automatically select plugin after auto-update Summary: Select reloaded plugin automatically Reviewed By: mweststrate Differential Revision: D23987545 fbshipit-source-id: bf54ca54e4aa46b987d57e76fbc4f3e9e5fc336e --- desktop/app/src/Client.tsx | 1 - desktop/app/src/reducers/connections.tsx | 10 +++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/desktop/app/src/Client.tsx b/desktop/app/src/Client.tsx index 68a9108aa..a8579ceea 100644 --- a/desktop/app/src/Client.tsx +++ b/desktop/app/src/Client.tsx @@ -9,7 +9,6 @@ import { PluginDefinition, - ClientPluginDefinition, isSandyPlugin, FlipperPlugin, FlipperDevicePlugin, diff --git a/desktop/app/src/reducers/connections.tsx b/desktop/app/src/reducers/connections.tsx index 9a6800d57..65440f05d 100644 --- a/desktop/app/src/reducers/connections.tsx +++ b/desktop/app/src/reducers/connections.tsx @@ -246,7 +246,15 @@ export default (state: State = INITAL_STATE, action: Actions): State => { } } } - if (!selectDevice) { + if (!selectedDevice && selectedPlugin) { + const selectedClient = state.clients.find((c) => + c.supportsPlugin(selectedPlugin), + ); + selectedDevice = state.devices.find( + (v) => v.serial === selectedClient?.query.device_id, + ); + } + if (!selectedDevice) { console.warn('Trying to select a plugin before a device was selected!'); } if (selectedPlugin) {