From d8d40ae49b080e7b06b11aaac1d003914dfc0bf2 Mon Sep 17 00:00:00 2001 From: John Knox Date: Fri, 23 Nov 2018 06:31:01 -0800 Subject: [PATCH] Log when client connects for an unknown device Summary: We've seen this happen sometimes, e.g. when adb fails and we aren't showing any android devices, but the sdk still manages to connect. When we detect this, log an error so we can track how often it occurs. Reviewed By: passy Differential Revision: D13175639 fbshipit-source-id: b0f79b77ac04ad804e56448b3696a3ffeb30631e --- src/reducers/connections.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/reducers/connections.js b/src/reducers/connections.js index 83654b40e..199590660 100644 --- a/src/reducers/connections.js +++ b/src/reducers/connections.js @@ -226,6 +226,16 @@ export default function reducer( selectedPlugin = userPreferredPlugin; } + const matchingDeviceForClient = state.devices.filter( + device => payload.query.device_id === device.serial, + ); + if (matchingDeviceForClient.length === 0) { + console.error( + new RecurringError(`Client initialised for non-displayed device`), + payload.id, + ); + } + return { ...state, clients: state.clients.concat(payload),