fix(ui): clear client addons on PluginApi reset

This commit is contained in:
Guillaume Chau
2018-06-21 15:20:47 +02:00
parent c2da5fcc71
commit 3eb511665d
2 changed files with 9 additions and 1 deletions

View File

@@ -39,6 +39,12 @@ function remove (id, context) {
if (index !== -1) addons.splice(index, 1)
}
function clear (context) {
for (const addon of addons) {
remove(addon.id, context)
}
}
function getUrl (addon, context) {
return addon.url || `${baseUrl}/_addon/${addon.id}/index.js`
}
@@ -64,5 +70,6 @@ module.exports = {
remove,
findOne,
getUrl,
serve
serve,
clear
}

View File

@@ -102,6 +102,7 @@ function resetPluginApi (context) {
}
sharedData.unWatchAll()
clientAddons.clear(context)
suggestions.clear(context)
pluginApi = new PluginApi({