From b123a056aba49c9169d96b223b65e46c251d1dc3 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 11 Aug 2022 17:04:47 +0100 Subject: [PATCH] Notify client when plugins are added when saving screens --- packages/server/src/api/controllers/screen.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/src/api/controllers/screen.js b/packages/server/src/api/controllers/screen.js index 52a22f1073..1d5d876dc4 100644 --- a/packages/server/src/api/controllers/screen.js +++ b/packages/server/src/api/controllers/screen.js @@ -41,6 +41,7 @@ exports.save = async ctx => { // Find any custom components being used let pluginNames = [] + let pluginAdded = false findPlugins(screen.props, pluginNames) if (pluginNames.length) { const globalDB = getGlobalDB() @@ -62,7 +63,6 @@ exports.save = async ctx => { const application = await db.get(DocumentTypes.APP_METADATA) let usedPlugins = application.usedPlugins || [] - let pluginAdded = false requiredPlugins.forEach(plugin => { if (!usedPlugins.find(x => x._id === plugin._id)) { pluginAdded = true @@ -76,7 +76,6 @@ exports.save = async ctx => { }) if (pluginAdded) { - console.log("plugin added! new plugins", usedPlugins) await updateAppPackage({ usedPlugins }, ctx.appId) } } @@ -89,6 +88,7 @@ exports.save = async ctx => { ...screen, _id: response.id, _rev: response.rev, + pluginAdded, } }