From dd7c2ab96d7e5e4ec05a84c3ea5b3959c46cd20b Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Thu, 3 Dec 2020 07:19:02 -0800 Subject: [PATCH] Fix plugin meta data Summary: See previous diff, if the plugin `id` on the class definition mismatches with the `package.json`, the navigation in Sandy will use the wrong id (from the meta data) causing the plugin not to open. Since the `id` exposed on the class is the one that is used to setup the connect on the client, updated the ids in the `package.json` which have afaik no further meaning. Pinging nikoant to verify that assumption. I can imagine this might impact historical data / plugin distribution? Reviewed By: passy, nikoant Differential Revision: D25302542 fbshipit-source-id: 43fe1667604eb7a28f6f9b7d260bc2a1e6e82dd3 --- desktop/app/src/dispatcher/plugins.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/desktop/app/src/dispatcher/plugins.tsx b/desktop/app/src/dispatcher/plugins.tsx index 50daa7b93..c151a72a9 100644 --- a/desktop/app/src/dispatcher/plugins.tsx +++ b/desktop/app/src/dispatcher/plugins.tsx @@ -233,6 +233,11 @@ const requirePluginInternal = ( throw new Error(`Plugin ${plugin.name} is not a FlipperBasePlugin`); } + if (plugin.id && pluginDetails.id !== plugin.id) { + console.error( + `Plugin name mismatch: Package '${pluginDetails.id}' exposed a plugin with id '${plugin.id}'. Please update the 'package.json' to match the exposed plugin id`, + ); + } plugin.id = plugin.id || pluginDetails.id; plugin.packageName = pluginDetails.name; plugin.details = pluginDetails;