Filter out OS devices when finding valid clients

Summary: When running debug builds, and not specifying a `device=...` qualifier as part of the deeplink, you'd get stuck on the "waiting for plugin to be launched" dialogue as Flipper would accept the local MacOS (or Windows, ...) connection as a valid client which can be quite confusing.

Reviewed By: mweststrate

Differential Revision: D31857737

fbshipit-source-id: ff568544f660c51e17b40c2aaadf058588746ef9
This commit is contained in:
Pascal Hartig
2021-10-22 11:24:58 -07:00
committed by Facebook GitHub Bot
parent ece8b8e1a1
commit ec9e3aeb6e

View File

@@ -452,11 +452,16 @@ async function selectDevicesAndClient(
): Promise<false | BaseDevice | Client> { ): Promise<false | BaseDevice | Client> {
function findValidDevices() { function findValidDevices() {
// find connected devices with the right OS. // find connected devices with the right OS.
return store return (
store
.getState() .getState()
.connections.devices.filter((d) => d.connected.get()) .connections.devices.filter((d) => d.connected.get())
.filter( .filter(
(d) => params.devices.length === 0 || params.devices.includes(d.os), (d) => params.devices.length === 0 || params.devices.includes(d.os),
)
// This filters out OS-level devices which are causing more confusion than good
// when used with deeplinks.
.filter(canBeDefaultDevice)
); );
} }