diff --git a/client/src/components/Workflow/Editor/Index.vue b/client/src/components/Workflow/Editor/Index.vue index 893b445d06ec..871521c935f8 100644 --- a/client/src/components/Workflow/Editor/Index.vue +++ b/client/src/components/Workflow/Editor/Index.vue @@ -546,6 +546,12 @@ export default { const response = await axios.post(`${getAppRoot()}workflow/save_workflow_as`, formData); const newId = response.data; + if (!create) { + this.name = rename_name; + this.annotation = rename_annotation; + } + + this.hasChanges = false; await this.routeToWorkflow(newId); } catch (e) { this.onWorkflowError("Saving workflow failed, please contact an administrator."); @@ -575,18 +581,9 @@ export default { this.onUpdateStep(step); }, async routeToWorkflow(id) { - const { addScopePointer, scope } = useScopePointerStore(); - - let pointedTo; - // the current workflow id might be pointing to existing stores - const originalPointed = scope(this.id); - if (originalPointed !== this.id) { - pointedTo = originalPointed; - } else { - pointedTo = this.id; - } // map scoped stores to existing stores, before updating the id - addScopePointer(id, pointedTo); + const { addScopePointer } = useScopePointerStore(); + addScopePointer(id, this.id); this.id = id; await this.onSave(); @@ -618,7 +615,6 @@ export default { await this.routeToWorkflow(id); } else { // otherwise, use `save_as` endpoint to include steps, etc. - this.hasChanges = false; await this.doSaveAs(true); } } catch (e) { diff --git a/client/src/stores/scopePointerStore.ts b/client/src/stores/scopePointerStore.ts index b004878baf53..4d7c2df6232d 100644 --- a/client/src/stores/scopePointerStore.ts +++ b/client/src/stores/scopePointerStore.ts @@ -11,7 +11,7 @@ export const useScopePointerStore = defineStore("scopePointerStore", () => { const scopePointers = ref>({}); function addScopePointer(from: FromScopeId, to: ToScopeId) { - scopePointers.value[from] = to; + scopePointers.value[from] = scope.value(to); } const scope = computed(() => (scopeId: string) => scopePointers.value[scopeId] ?? scopeId);