fix(editor): Fix console error (#3751)

This commit is contained in:
Mutasem Aldmour 2022-07-21 13:45:35 +02:00 committed by GitHub
parent 5efe4a4c54
commit 3a98028722
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -115,7 +115,7 @@ export default mixins(
},
showDraggableHint(): boolean {
const toIgnore = [START_NODE_TYPE, CRON_NODE_TYPE, INTERVAL_NODE_TYPE];
if (toIgnore.includes(this.currentNode.type)) {
if (!this.currentNode || toIgnore.includes(this.currentNode.type)) {
return false;
}
@ -145,7 +145,7 @@ export default mixins(
activeNode (): INodeUi | null {
return this.$store.getters.activeNode;
},
currentNode (): INodeUi {
currentNode (): INodeUi | null {
return this.$store.getters.getNodeByName(this.currentNodeName);
},
connectedCurrentNodeOutputs(): number[] | undefined {
@ -164,7 +164,7 @@ export default mixins(
return nodes.filter(({name}, i) => (this.activeNode && (name !== this.activeNode.name)) && nodes.findIndex((node) => node.name === name) === i);
},
currentNodeDepth (): number {
const node = this.parentNodes.find((node) => node.name === this.currentNode.name);
const node = this.parentNodes.find((node) => this.currentNode && node.name === this.currentNode.name);
return node ? node.depth: -1;
},
},