mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(editor): Prevent workflow execution list infinite no network error (#5230)
fix(editor): Prevent workflow execution list create infinite no network error messages
This commit is contained in:
parent
09bdd96d29
commit
0d33329bc8
|
@ -54,7 +54,7 @@ import { Route } from 'vue-router';
|
||||||
import { executionHelpers } from '@/mixins/executionsHelpers';
|
import { executionHelpers } from '@/mixins/executionsHelpers';
|
||||||
import { range as _range } from 'lodash';
|
import { range as _range } from 'lodash';
|
||||||
import { debounceHelper } from '@/mixins/debounce';
|
import { debounceHelper } from '@/mixins/debounce';
|
||||||
import { getNodeViewTab } from '@/utils';
|
import { getNodeViewTab, NO_NETWORK_ERROR_CODE } from '@/utils';
|
||||||
import { workflowHelpers } from '@/mixins/workflowHelpers';
|
import { workflowHelpers } from '@/mixins/workflowHelpers';
|
||||||
import { mapStores } from 'pinia';
|
import { mapStores } from 'pinia';
|
||||||
import { useWorkflowsStore } from '@/stores/workflows';
|
import { useWorkflowsStore } from '@/stores/workflows';
|
||||||
|
@ -372,8 +372,9 @@ export default mixins(
|
||||||
if (updatedActiveExecution !== null) {
|
if (updatedActiveExecution !== null) {
|
||||||
this.workflowsStore.activeWorkflowExecution = updatedActiveExecution;
|
this.workflowsStore.activeWorkflowExecution = updatedActiveExecution;
|
||||||
} else {
|
} else {
|
||||||
const activeNotInTheList =
|
const activeNotInTheList = !existingExecutions.some(
|
||||||
existingExecutions.find((ex) => ex.id === this.activeExecution.id) === undefined;
|
(ex) => ex.id === this.activeExecution?.id,
|
||||||
|
);
|
||||||
if (activeNotInTheList && this.executions.length > 0) {
|
if (activeNotInTheList && this.executions.length > 0) {
|
||||||
this.$router
|
this.$router
|
||||||
.push({
|
.push({
|
||||||
|
@ -394,7 +395,22 @@ export default mixins(
|
||||||
try {
|
try {
|
||||||
return await this.workflowsStore.loadCurrentWorkflowExecutions(this.filter);
|
return await this.workflowsStore.loadCurrentWorkflowExecutions(this.filter);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.$showError(error, this.$locale.baseText('executionsList.showError.refreshData.title'));
|
if (error.errorCode === NO_NETWORK_ERROR_CODE) {
|
||||||
|
this.$showMessage(
|
||||||
|
{
|
||||||
|
title: this.$locale.baseText('executionsList.showError.refreshData.title'),
|
||||||
|
message: error.message,
|
||||||
|
type: 'error',
|
||||||
|
duration: 3500,
|
||||||
|
},
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.$showError(
|
||||||
|
error,
|
||||||
|
this.$locale.baseText('executionsList.showError.refreshData.title'),
|
||||||
|
);
|
||||||
|
}
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import axios, { AxiosRequestConfig, Method } from 'axios';
|
import axios, { AxiosRequestConfig, Method } from 'axios';
|
||||||
import { IDataObject } from 'n8n-workflow';
|
import { IDataObject } from 'n8n-workflow';
|
||||||
import type { IRestApiContext } from '../Interface';
|
import type { IRestApiContext } from '@/Interface';
|
||||||
|
|
||||||
|
export const NO_NETWORK_ERROR_CODE = 999;
|
||||||
|
|
||||||
class ResponseError extends Error {
|
class ResponseError extends Error {
|
||||||
// The HTTP status code of response
|
// The HTTP status code of response
|
||||||
|
@ -67,7 +69,9 @@ async function request(config: {
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.message === 'Network Error') {
|
if (error.message === 'Network Error') {
|
||||||
throw new ResponseError('API-Server can not be reached. It is probably down.');
|
throw new ResponseError('API-Server can not be reached. It is probably down.', {
|
||||||
|
errorCode: NO_NETWORK_ERROR_CODE,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const errorResponseData = error.response.data;
|
const errorResponseData = error.response.data;
|
||||||
|
|
Loading…
Reference in a new issue