From 8cf3c868609447df20876d5ef5f25575bbe9da9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Tue, 3 Jan 2023 14:40:51 +0100 Subject: [PATCH] fix(editor): Fix an infinite loop while loading executions that are not on the current executions list (#5071) fix(editor): Fix an infinitine loop while loading executions that are not on the current executions list --- .../src/components/ExecutionsView/ExecutionsView.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/editor-ui/src/components/ExecutionsView/ExecutionsView.vue b/packages/editor-ui/src/components/ExecutionsView/ExecutionsView.vue index 0d764562b..22fccbad3 100644 --- a/packages/editor-ui/src/components/ExecutionsView/ExecutionsView.vue +++ b/packages/editor-ui/src/components/ExecutionsView/ExecutionsView.vue @@ -426,9 +426,9 @@ export default mixins( .catch(() => {}); } }, - async tryToFindExecution(executionId: string, skipCheck = false): Promise { + async tryToFindExecution(executionId: string, attemptCount = 0): Promise { // First check if executions exists in the DB at all - if (!skipCheck) { + if (attemptCount === 0) { const executionExists = await this.workflowsStore.fetchExecutionDataById(executionId); if (!executionExists) { this.workflowsStore.activeWorkflowExecution = null; @@ -443,6 +443,10 @@ export default mixins( return; } } + + // stop if the execution wasn't found in the first 1000 lookups + if (attemptCount >= 10) return; + // Fetch next batch of executions await this.loadMore(100); const execution = this.workflowsStore.getExecutionDataById(executionId); @@ -450,7 +454,7 @@ export default mixins( // If it's not there load next until found await this.$nextTick(); // But skip fetching execution data since we at this point know it exists - await this.tryToFindExecution(executionId, true); + await this.tryToFindExecution(executionId, attemptCount + 1); } else { // When found set execution as active this.workflowsStore.activeWorkflowExecution = execution;