diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index be10cc58bf..617aabcb41 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -349,6 +349,7 @@ export default mixins( this.$externalHooks().run('nodeView.createNodeActiveChanged', { source: 'add_node_button' }); }, async openExecution (executionId: string) { + this.resetWorkspace(); let data: IExecutionResponse | undefined; try { @@ -368,6 +369,10 @@ export default mixins( this.$store.commit('setWorkflowExecutionData', data); await this.addNodes(JSON.parse(JSON.stringify(data.workflowData.nodes)), JSON.parse(JSON.stringify(data.workflowData.connections))); + this.$nextTick(() => { + this.zoomToFit(); + this.$store.commit('setStateDirty', false); + }); this.$externalHooks().run('execution.open', { workflowId: data.workflowData.id, workflowName: data.workflowData.name, executionId }); }, @@ -824,6 +829,10 @@ export default mixins( zoomToFit () { const nodes = this.$store.getters.allNodes as INodeUi[]; + if (nodes.length === 0) { // some unknown workflow executions + return; + } + const {minX, minY, maxX, maxY} = getWorkflowCorners(nodes); const PADDING = NODE_SIZE * 4;