Notify client when plugins are added when saving screens

This commit is contained in:
Andrew Kingston 2022-08-11 17:04:47 +01:00
parent 05553916ff
commit b123a056ab
1 changed files with 2 additions and 2 deletions

View File

@ -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,
}
}