Refresh on new plugins

Summary:
afcoplan found a bug in the deeplink opening flow: If a device is open but not the app that supports a supported plugin, the dialogue won't disappear once the app is connected.

That is because apps are initialised with an empty plugin list and we're doing a reference equality check to get notified of changes which won't get triggered when the deep `plugin` property is changed.

Instead, we additionally wait for the `plugin-change` event that's emitted by the client to refresh.

Differential Revision: D31861521

fbshipit-source-id: 88fc456553e218f9c8ea68435ff84bdae0d1b586
This commit is contained in:
Pascal Hartig
2021-10-25 03:17:06 -07:00
committed by Facebook GitHub Bot
parent ec9e3aeb6e
commit 0b44931e2b

View File

@@ -528,6 +528,14 @@ async function selectDevicesAndClient(
resolve(true);
},
);
// We also want to react to changes in the available plugins and refresh.
origClients.forEach((c) =>
c.on('plugins-change', () => {
dialog.close();
resolve(true);
}),
);
});
if (!result) {