mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 18:41:14 +00:00
fix(editor): Implement dirty nodes for partial executions (#11739)
Co-authored-by: Danny Martini <danny@n8n.io>
This commit is contained in:
committed by
GitHub
parent
57d3269e40
commit
b8da4ff9ed
@@ -37,6 +37,25 @@ import { get } from 'lodash-es';
|
||||
import { useExecutionsStore } from '@/stores/executions.store';
|
||||
import { useLocalStorage } from '@vueuse/core';
|
||||
|
||||
const getDirtyNodeNames = (
|
||||
runData: IRunData,
|
||||
getParametersLastUpdate: (nodeName: string) => number | undefined,
|
||||
): string[] | undefined => {
|
||||
const dirtyNodeNames = Object.entries(runData).reduce<string[]>((acc, [nodeName, tasks]) => {
|
||||
if (!tasks.length) return acc;
|
||||
|
||||
const updatedAt = getParametersLastUpdate(nodeName) ?? 0;
|
||||
|
||||
if (updatedAt > tasks[0].startTime) {
|
||||
acc.push(nodeName);
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, []);
|
||||
|
||||
return dirtyNodeNames.length ? dirtyNodeNames : undefined;
|
||||
};
|
||||
|
||||
export function useRunWorkflow(useRunWorkflowOpts: { router: ReturnType<typeof useRouter> }) {
|
||||
const nodeHelpers = useNodeHelpers();
|
||||
const workflowHelpers = useWorkflowHelpers({ router: useRunWorkflowOpts.router });
|
||||
@@ -244,6 +263,13 @@ export function useRunWorkflow(useRunWorkflowOpts: { router: ReturnType<typeof u
|
||||
startRunData.destinationNode = options.destinationNode;
|
||||
}
|
||||
|
||||
if (startRunData.runData) {
|
||||
startRunData.dirtyNodeNames = getDirtyNodeNames(
|
||||
startRunData.runData,
|
||||
workflowsStore.getParametersLastUpdate,
|
||||
);
|
||||
}
|
||||
|
||||
// Init the execution data to represent the start of the execution
|
||||
// that data which gets reused is already set and data of newly executed
|
||||
// nodes can be added as it gets pushed in
|
||||
|
||||
Reference in New Issue
Block a user