From 0b44931e2bb6a6279b88d7c44f82f01fa69eb05f Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Mon, 25 Oct 2021 03:17:06 -0700 Subject: [PATCH] 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 --- desktop/app/src/dispatcher/handleOpenPluginDeeplink.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/desktop/app/src/dispatcher/handleOpenPluginDeeplink.tsx b/desktop/app/src/dispatcher/handleOpenPluginDeeplink.tsx index d27bcf420..e4f763767 100644 --- a/desktop/app/src/dispatcher/handleOpenPluginDeeplink.tsx +++ b/desktop/app/src/dispatcher/handleOpenPluginDeeplink.tsx @@ -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) {