@ -907,8 +907,8 @@ const workflowStoreImpl: StateCreator<WorkflowStore> = (set, get) => ({
) ;
) ;
// Deep clone the nodes and edges to avoid reference issues
// Deep clone the nodes and edges to avoid reference issues
const clonedNodes = JSON . parse ( JSON . stringify ( selectedNodes ) ) as WorkflowNode [ ] ;
const clonedNodes = clonePreservingStrings ( selectedNodes ) as WorkflowNode [ ] ;
const clonedEdges = JSON . parse ( JSON . stringify ( connectedEdges ) ) as WorkflowEdge [ ] ;
const clonedEdges = clonePreservingStrings ( connectedEdges ) as WorkflowEdge [ ] ;
set ( { clipboard : { nodes : clonedNodes , edges : clonedEdges } } ) ;
set ( { clipboard : { nodes : clonedNodes , edges : clonedEdges } } ) ;
} ,
} ,
@ -946,7 +946,7 @@ const workflowStoreImpl: StateCreator<WorkflowStore> = (set, get) => ({
width : undefined ,
width : undefined ,
height : undefined ,
height : undefined ,
measured : undefined ,
measured : undefined ,
data : JSON.parse ( JSON . stringify ( node . data ) ) ,
data : clonePreservingStrings ( node . data ) ,
} ;
} ;
} ) ;
} ) ;
@ -2536,12 +2536,12 @@ const workflowStoreImpl: StateCreator<WorkflowStore> = (set, get) => ({
captureSnapshot : ( ) = > {
captureSnapshot : ( ) = > {
const state = get ( ) ;
const state = get ( ) ;
// Deep copy the current workflow state to avoid reference sharing
// Deep copy the current workflow state to avoid reference sharing
const snapshot = {
const snapshot = clonePreservingStrings ( {
nodes : JSON.parse ( JSON . stringify ( state . nodes ) ) ,
nodes : state.nodes ,
edges : JSON.parse ( JSON . stringify ( state . edges ) ) ,
edges : state.edges ,
groups : JSON.parse ( JSON . stringify ( state . groups ) ) ,
groups : state.groups ,
edgeStyle : state.edgeStyle ,
edgeStyle : state.edgeStyle ,
} ;
} ) ;
set ( {
set ( {
previousWorkflowSnapshot : snapshot ,
previousWorkflowSnapshot : snapshot ,
manualChangeCount : 0 ,
manualChangeCount : 0 ,