diff --git a/packages/editor-ui/src/components/MainSidebar.vue b/packages/editor-ui/src/components/MainSidebar.vue index 316dc16879..09faab9bc7 100644 --- a/packages/editor-ui/src/components/MainSidebar.vue +++ b/packages/editor-ui/src/components/MainSidebar.vue @@ -431,7 +431,11 @@ export default mixins( const importConfirm = await this.confirmMessage(`When you switch workflows your current workflow changes will be lost.`, 'Save your Changes?', 'warning', 'Yes, switch workflows and forget changes'); if (importConfirm === true) { this.$store.commit('setStateDirty', false); - this.$router.push({ name: 'NodeViewNew' }); + if (this.$router.currentRoute.name === 'NodeViewNew') { + this.$root.$emit('newWorkflow'); + } else { + this.$router.push({ name: 'NodeViewNew' }); + } this.$showMessage({ title: 'Workflow created', @@ -440,7 +444,9 @@ export default mixins( }); } } else { - this.$router.push({ name: 'NodeViewNew' }); + if (this.$router.currentRoute.name !== 'NodeViewNew') { + this.$router.push({ name: 'NodeViewNew' }); + } this.$showMessage({ title: 'Workflow created', diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index 0bc1275d26..d04c9fafb5 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -495,10 +495,14 @@ export default mixins( e.stopPropagation(); e.preventDefault(); - this.$router.push({ name: 'NodeViewNew' }); + if (this.$router.currentRoute.name === 'NodeViewNew') { + this.$root.$emit('newWorkflow'); + } else { + this.$router.push({ name: 'NodeViewNew' }); + } this.$showMessage({ - title: 'Created', + title: 'Workflow created', message: 'A new workflow got created!', type: 'success', }); @@ -2063,6 +2067,8 @@ export default mixins( const resData = await this.importWorkflowData(data.data as IWorkflowDataUpdate); }); + this.$root.$on('newWorkflow', this.newWorkflow); + this.$root.$on('importWorkflowUrl', async (data: IDataObject) => { const workflowData = await this.getWorkflowDataFromUrl(data.url as string); if (workflowData !== undefined) {