From d8ff19a372140451ab3014b26fcd35ba5b7bdef7 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed, 27 Dec 2023 22:53:00 -0800 Subject: [PATCH] Fix workflow changes getting saved on cancel --- .../components/manage/workflows/workflows.component.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src-ui/src/app/components/manage/workflows/workflows.component.ts b/src-ui/src/app/components/manage/workflows/workflows.component.ts index 70b7cb86e..293473888 100644 --- a/src-ui/src/app/components/manage/workflows/workflows.component.ts +++ b/src-ui/src/app/components/manage/workflows/workflows.component.ts @@ -65,7 +65,13 @@ export class WorkflowsComponent modal.componentInstance.dialogMode = workflow ? EditDialogMode.EDIT : EditDialogMode.CREATE - modal.componentInstance.object = workflow + if (workflow) { + // quick "deep" clone so original doesnt get modified + const clone = Object.assign({}, workflow) + clone.actions = [...workflow.actions] + clone.triggers = [...workflow.triggers] + modal.componentInstance.object = clone + } modal.componentInstance.succeeded .pipe(takeUntil(this.unsubscribeNotifier)) .subscribe((newWorkflow) => {