Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Disappearing node and connection bug fix (#500)

zooi49ad80206dbb
diff --git a/ui/component/or-rules/src/flow-viewer/services/project.ts b/ui/component/or-rules/src/flow-viewer/services/project.ts
index c9a9ca6a4..e1c240d96 100644
--- a/ui/component/or-rules/src/flow-viewer/services/project.ts
+++ b/ui/component/or-rules/src/flow-viewer/services/project.ts
@@ -78,13 +78,15 @@ export class Project extends EventEmitter {
public async fromNodeCollection(collection: NodeCollection) {
await this.clear();
+
collection.nodes!.forEach((node) => {
this.addNode(node);
});
- if(this.workspace) await this.workspace.updateComplete;
+
collection.connections!.forEach((conn) => {
this.createConnection(conn.from!, conn.to!);
});
+
this.emit("nodecollectionloaded", collection);
this.unsavedState = false;
}
@@ -103,9 +105,6 @@ export class Project extends EventEmitter {
this.nodes.forEach((n) => {
this.removeNode(n);
});
- if (this.workspace) {
- await this.workspace.updateComplete;
- }
this.nodes = [];
this.connections = [];
this.unsavedState = !alsoResetProject;