mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
perf(editor): Avoid deep watch on execution result data (#15304)
This commit is contained in:
@@ -5,7 +5,6 @@ import { Workflow } from 'n8n-workflow';
|
||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||
import { useNodeHelpers } from '@/composables/useNodeHelpers';
|
||||
import { useThrottleFn } from '@vueuse/core';
|
||||
import { IN_PROGRESS_EXECUTION_ID } from '@/constants';
|
||||
import {
|
||||
createLogEntries,
|
||||
deepToRaw,
|
||||
@@ -58,13 +57,6 @@ export function useExecutionData() {
|
||||
};
|
||||
});
|
||||
const updateInterval = computed(() => ((execution.value?.tree.length ?? 0) > 10 ? 300 : 0));
|
||||
const runStatusList = computed(() =>
|
||||
workflowsStore.workflowExecutionData?.id === IN_PROGRESS_EXECUTION_ID
|
||||
? Object.values(workflowsStore.workflowExecutionData?.data?.resultData.runData ?? {})
|
||||
.flatMap((tasks) => tasks.map((task) => task.executionStatus ?? ''))
|
||||
.join('|')
|
||||
: '',
|
||||
);
|
||||
|
||||
function resetExecutionData() {
|
||||
execData.value = undefined;
|
||||
@@ -78,7 +70,7 @@ export function useExecutionData() {
|
||||
() => workflowsStore.workflowExecutionData?.id,
|
||||
() => workflowsStore.workflowExecutionData?.workflowData.id,
|
||||
() => workflowsStore.workflowExecutionData?.status,
|
||||
runStatusList,
|
||||
() => workflowsStore.workflowExecutionResultDataLastUpdate,
|
||||
],
|
||||
useThrottleFn(
|
||||
() => {
|
||||
|
||||
@@ -806,11 +806,11 @@ export const useAssistantStore = defineStore(STORES.ASSISTANT, () => {
|
||||
);
|
||||
|
||||
watch(
|
||||
() => workflowsStore.workflowExecutionData?.data?.resultData ?? {},
|
||||
() => workflowsStore.workflowExecutionResultDataLastUpdate,
|
||||
() => {
|
||||
workflowExecutionDataStale.value = true;
|
||||
},
|
||||
{ deep: true, immediate: true },
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
return {
|
||||
|
||||
@@ -141,6 +141,7 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => {
|
||||
const activeWorkflowExecution = ref<ExecutionSummary | null>(null);
|
||||
const currentWorkflowExecutions = ref<ExecutionSummary[]>([]);
|
||||
const workflowExecutionData = ref<IExecutionResponse | null>(null);
|
||||
const workflowExecutionResultDataLastUpdate = ref<number>();
|
||||
const workflowExecutionPairedItemMappings = ref<Record<string, Set<string>>>({});
|
||||
const subWorkflowExecutionError = ref<Error | null>(null);
|
||||
const executionWaitingForWebhook = ref(false);
|
||||
@@ -866,6 +867,7 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => {
|
||||
}
|
||||
workflowExecutionData.value = workflowResultData;
|
||||
workflowExecutionPairedItemMappings.value = getPairedItemsMapping(workflowResultData);
|
||||
workflowExecutionResultDataLastUpdate.value = Date.now();
|
||||
}
|
||||
|
||||
function setWorkflowExecutionRunData(workflowResultData: IRunExecutionData) {
|
||||
@@ -874,6 +876,7 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => {
|
||||
...workflowExecutionData.value,
|
||||
data: workflowResultData,
|
||||
};
|
||||
workflowExecutionResultDataLastUpdate.value = Date.now();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1497,6 +1500,7 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => {
|
||||
executionTime: 0,
|
||||
...data.data,
|
||||
});
|
||||
workflowExecutionResultDataLastUpdate.value = Date.now();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1545,6 +1549,8 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => {
|
||||
tasksData.push(data);
|
||||
}
|
||||
|
||||
workflowExecutionResultDataLastUpdate.value = Date.now();
|
||||
|
||||
void trackNodeExecution(pushData);
|
||||
}
|
||||
}
|
||||
@@ -1830,6 +1836,7 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => {
|
||||
currentWorkflowExecutions,
|
||||
workflowExecutionData,
|
||||
workflowExecutionPairedItemMappings,
|
||||
workflowExecutionResultDataLastUpdate,
|
||||
activeExecutionId: readonlyActiveExecutionId,
|
||||
previousExecutionId: readonlyPreviousExecutionId,
|
||||
setActiveExecutionId,
|
||||
|
||||
Reference in New Issue
Block a user