From 8506769a3065bc4bf5ff441d6561819603048623 Mon Sep 17 00:00:00 2001 From: Laila Los <44241786+ElectronicBlueberry@users.noreply.github.com> Date: Fri, 19 Jan 2024 11:35:18 +0100 Subject: [PATCH] look for changes in both id and stored id for better reload control --- .../entry/analysis/modules/WorkflowEditor.vue | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/client/src/entry/analysis/modules/WorkflowEditor.vue b/client/src/entry/analysis/modules/WorkflowEditor.vue index 37f46db6f15..9ed4b55b3b9 100644 --- a/client/src/entry/analysis/modules/WorkflowEditor.vue +++ b/client/src/entry/analysis/modules/WorkflowEditor.vue @@ -37,19 +37,27 @@ export default { }, methods: { async getEditorConfig() { - const storedWorkflowId = Query.get("id"); - const workflowId = Query.get("workflow_id"); + let reloadEditor = true; + + // this will only be the case the first time the route updates from a new workflow + if (!this.storedWorkflowId && !this.workflowId) { + reloadEditor = false; + } + + this.storedWorkflowId = Query.get("id"); + this.workflowId = Query.get("workflow_id"); + const params = {}; - if (workflowId) { - params.workflow_id = workflowId; - } else if (storedWorkflowId) { - params.id = storedWorkflowId; + + if (this.workflowId) { + params.workflow_id = this.workflowId; + } else if (this.storedWorkflowId) { + params.id = this.storedWorkflowId; } - const previousId = this.editorConfig?.id; this.editorConfig = await urlData({ url: "/workflow/editor", params }); - if (previousId !== undefined && previousId !== this.editorConfig?.id) { + if (reloadEditor) { this.editorReloadKey += 1; } },