1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Reorder inital load so projects:load event emits before any nodes:add

This commit is contained in:
Nick O'Leary 2020-04-27 10:49:14 +01:00
parent efb9dce92f
commit f78be9050a
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 9 additions and 6 deletions

View File

@ -124,9 +124,9 @@ var RED = (function() {
$("#red-ui-palette > .red-ui-palette-spinner").hide(); $("#red-ui-palette > .red-ui-palette-spinner").hide();
$(".red-ui-palette-scroll").removeClass("hide"); $(".red-ui-palette-scroll").removeClass("hide");
$("#red-ui-palette-search").removeClass("hide"); $("#red-ui-palette-search").removeClass("hide");
loadFlows(function() { if (RED.settings.theme("projects.enabled",false)) {
if (RED.settings.theme("projects.enabled",false)) { RED.projects.refresh(function(activeProject) {
RED.projects.refresh(function(activeProject) { loadFlows(function() {
RED.sidebar.info.refresh() RED.sidebar.info.refresh()
if (!activeProject) { if (!activeProject) {
// Projects enabled but no active project // Projects enabled but no active project
@ -140,12 +140,14 @@ var RED = (function() {
} }
completeLoad(); completeLoad();
}); });
} else { });
} else {
loadFlows(function() {
// Projects disabled by the user // Projects disabled by the user
RED.sidebar.info.refresh() RED.sidebar.info.refresh()
completeLoad(); completeLoad();
} });
}); }
} else { } else {
var config = configs.shift(); var config = configs.shift();
appendNodeConfig(config,stepConfig); appendNodeConfig(config,stepConfig);

View File

@ -2312,6 +2312,7 @@ RED.projects = (function() {
if (data.active) { if (data.active) {
$.getJSON("projects/"+data.active, function(project) { $.getJSON("projects/"+data.active, function(project) {
activeProject = project; activeProject = project;
RED.events.emit("projects:load",activeProject);
RED.sidebar.versionControl.refresh(true); RED.sidebar.versionControl.refresh(true);
if (done) { if (done) {
done(activeProject); done(activeProject);