From 92e27737b3d7246b9cbd39c54e8ea4aa271224c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20G=C3=B3mez=20Morales?= Date: Thu, 5 Dec 2024 14:59:03 +0100 Subject: [PATCH] fix(editor): Fix Nodeview.v2 reinitialise based on route changes (#12062) --- packages/editor-ui/src/views/NodeView.v2.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/editor-ui/src/views/NodeView.v2.vue b/packages/editor-ui/src/views/NodeView.v2.vue index cff29f630e..2212a42cec 100644 --- a/packages/editor-ui/src/views/NodeView.v2.vue +++ b/packages/editor-ui/src/views/NodeView.v2.vue @@ -291,7 +291,7 @@ async function initializeData() { } } -async function initializeRoute() { +async function initializeRoute(force = false) { // In case the workflow got saved we do not have to run init // as only the route changed but all the needed data is already loaded if (route.params.action === 'workflowSave') { @@ -300,6 +300,7 @@ async function initializeRoute() { } const isAlreadyInitialized = + !force && initializedWorkflowId.value && [NEW_WORKFLOW_ID, workflowId.value].includes(initializedWorkflowId.value); @@ -1489,8 +1490,10 @@ function unregisterCustomActions() { watch( () => route.name, - async () => { - await initializeRoute(); + async (newRouteName, oldRouteName) => { + // it's navigating from and existing workflow to a new workflow + const force = newRouteName === VIEWS.NEW_WORKFLOW && oldRouteName === VIEWS.WORKFLOW; + await initializeRoute(force); }, );