mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 03:12:15 +00:00
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:
committed by
GitHub
parent
cae2b01288
commit
4bbf7cb749
27
packages/frontend/editor-ui/src/utils/workflowUtils.ts
Normal file
27
packages/frontend/editor-ui/src/utils/workflowUtils.ts
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user