mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #3999 from node-red/fix-plugin-async
Fix async loading of modules containing both nodes and plugins
This commit is contained in:
commit
8382665bbb
@ -126,38 +126,24 @@ function loadModuleFiles(modules) {
|
||||
}
|
||||
var pluginList;
|
||||
var nodeList;
|
||||
|
||||
return Promise.all(pluginPromises).then(function(results) {
|
||||
pluginList = results.filter(r => !!r);
|
||||
// Initial plugin load has happened. Ensure modules that provide
|
||||
// plugins are in the registry now.
|
||||
for (var module in modules) {
|
||||
if (modules.hasOwnProperty(module)) {
|
||||
if (modules[module].plugins && Object.keys(modules[module].plugins).length > 0) {
|
||||
// Add the modules for plugins
|
||||
if (!modules[module].err) {
|
||||
registry.addModule(modules[module]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return loadNodeSetList(pluginList);
|
||||
}).then(function() {
|
||||
return Promise.all(nodePromises);
|
||||
return Promise.all(nodePromises)
|
||||
}).then(function(results) {
|
||||
nodeList = results.filter(r => !!r);
|
||||
// Initial node load has happened. Ensure remaining modules are in the registry
|
||||
for (var module in modules) {
|
||||
if (modules.hasOwnProperty(module)) {
|
||||
if (!modules[module].plugins || Object.keys(modules[module].plugins).length === 0) {
|
||||
if (!modules[module].err) {
|
||||
registry.addModule(modules[module]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}).then(function() {
|
||||
return loadNodeSetList(pluginList);
|
||||
}).then(function() {
|
||||
return loadNodeSetList(nodeList);
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
async function loadPluginTemplate(plugin) {
|
||||
|
Loading…
Reference in New Issue
Block a user