From 50c18a789a79b23a95830bdfd376ed6461d852d5 Mon Sep 17 00:00:00 2001 From: Mutasem Aldmour <4711238+mutdmour@users.noreply.github.com> Date: Wed, 19 Oct 2022 15:20:33 +0200 Subject: [PATCH] fix(editor): fix workflow not stopping on clicking stop button (#4382) * fix(editor): fix workflow not stopping * address comment, fix for unsaved workflows --- packages/editor-ui/src/Interface.ts | 2 +- packages/editor-ui/src/components/mixins/pushConnection.ts | 2 +- packages/editor-ui/src/components/mixins/restApi.ts | 4 ++-- packages/editor-ui/src/views/NodeView.vue | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/editor-ui/src/Interface.ts b/packages/editor-ui/src/Interface.ts index cc1ee7a8a..1a10c0f4c 100644 --- a/packages/editor-ui/src/Interface.ts +++ b/packages/editor-ui/src/Interface.ts @@ -180,7 +180,7 @@ export interface IRestApi { getWorkflow(id: string): Promise; getWorkflows(filter?: object): Promise; getWorkflowFromUrl(url: string): Promise; - getExecution(id: string): Promise; + getExecution(id: string): Promise; deleteExecutions(sendData: IExecutionDeleteFilter): Promise; retryExecution(id: string, loadWorkflow?: boolean): Promise; getTimezones(): Promise; diff --git a/packages/editor-ui/src/components/mixins/pushConnection.ts b/packages/editor-ui/src/components/mixins/pushConnection.ts index 38817a5ea..866a38767 100644 --- a/packages/editor-ui/src/components/mixins/pushConnection.ts +++ b/packages/editor-ui/src/components/mixins/pushConnection.ts @@ -260,7 +260,7 @@ export const pushConnection = mixins( this.$titleSet(workflow.name as string, 'ERROR'); if ( - runDataExecuted.data.resultData.error!.name === 'ExpressionError' && + runDataExecuted.data.resultData.error?.name === 'ExpressionError' && (runDataExecuted.data.resultData.error as ExpressionError).context.functionality === 'pairedItem' ) { const error = runDataExecuted.data.resultData.error as ExpressionError; diff --git a/packages/editor-ui/src/components/mixins/restApi.ts b/packages/editor-ui/src/components/mixins/restApi.ts index 1a70d3967..ecf3c48f2 100644 --- a/packages/editor-ui/src/components/mixins/restApi.ts +++ b/packages/editor-ui/src/components/mixins/restApi.ts @@ -129,9 +129,9 @@ export const restApi = Vue.extend({ }, // Returns the execution with the given name - getExecution: async (id: string): Promise => { + getExecution: async (id: string): Promise => { const response = await self.restApi().makeRestApiRequest('GET', `/executions/${id}`); - return unflattenExecutionData(response); + return response && unflattenExecutionData(response); }, // Deletes executions diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index 9c6508d02..9ba2eaf4d 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -1231,7 +1231,7 @@ export default mixins( } catch (error) { // Execution stop might fail when the execution has already finished. Let's treat this here. const execution = await this.restApi().getExecution(executionId); - if (execution.finished) { + if (execution?.finished) { const executedData = { data: execution.data, finished: execution.finished,