fix(editor): Prevent execution data from leaking into workflow diffs UI (#18605)

Co-authored-by: Csaba Tuncsik <csaba@n8n.io>
This commit is contained in:
Raúl Gómez Morales
2025-08-28 09:39:32 +02:00
committed by GitHub
parent cae2b01288
commit 4bbf7cb749
5 changed files with 166 additions and 44 deletions

View File

@@ -0,0 +1,27 @@
import type { IWorkflowDb, INodeUi } from '@/Interface';
/**
* Removes execution data from workflow nodes and workflow-level execution data
* to ensure clean comparisons in diffs. This prevents execution status, run data,
* pinned data, and other runtime information from appearing in workflow difference
* comparisons.
*/
export function removeWorkflowExecutionData(
workflow: IWorkflowDb | undefined,
): IWorkflowDb | undefined {
if (!workflow) return workflow;
// Remove workflow-level execution data and clean up nodes
const { pinData, ...cleanWorkflow } = workflow;
const sanitizedWorkflow: IWorkflowDb = {
...cleanWorkflow,
nodes: workflow.nodes.map((node: INodeUi) => {
// Create a clean copy without execution-related data
const { issues, pinData, ...cleanNode } = node;
return cleanNode;
}),
};
return sanitizedWorkflow;
}