fix(editor): Fix Nodeview.v2 reinitialise based on route changes (#12062)
Some checks are pending
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions

This commit is contained in:
Raúl Gómez Morales 2024-12-05 14:59:03 +01:00 committed by GitHub
parent 706702dff8
commit b1f8663265
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);
},
);