@@ -2047,9 +2047,7 @@ const WorkflowContent = React.memo(() => {
20472047 ( changes : NodeChange [ ] ) => {
20482048 setDisplayNodes ( ( nds ) => {
20492049 const updated = applyNodeChanges ( changes , nds )
2050- const hasSelectionChange = changes . some (
2051- ( c ) => c . type === 'select' && ( c as { selected ?: boolean } ) . selected
2052- )
2050+ const hasSelectionChange = changes . some ( ( c ) => c . type === 'select' )
20532051 return hasSelectionChange ? resolveParentChildSelectionConflicts ( updated , blocks ) : updated
20542052 } )
20552053 } ,
@@ -2857,16 +2855,14 @@ const WorkflowContent = React.memo(() => {
28572855 setDragStartParentId ( firstNodeParentId )
28582856 }
28592857
2860- // Resolve parent-child conflicts and capture positions for undo/redo
2861- setDisplayNodes ( ( allNodes ) => resolveParentChildSelectionConflicts ( allNodes , blocks ) )
2862-
28632858 // Filter to nodes that won't be deselected (exclude children whose parent is selected)
28642859 const nodeIds = new Set ( nodes . map ( ( n ) => n . id ) )
28652860 const effectiveNodes = nodes . filter ( ( n ) => {
28662861 const parentId = blocks [ n . id ] ?. data ?. parentId
28672862 return ! parentId || ! nodeIds . has ( parentId )
28682863 } )
28692864
2865+ // Capture positions for undo/redo before applying display changes
28702866 multiNodeDragStartRef . current . clear ( )
28712867 effectiveNodes . forEach ( ( n ) => {
28722868 const blk = blocks [ n . id ]
@@ -2878,6 +2874,9 @@ const WorkflowContent = React.memo(() => {
28782874 } )
28792875 }
28802876 } )
2877+
2878+ // Apply visual deselection of children
2879+ setDisplayNodes ( ( allNodes ) => resolveParentChildSelectionConflicts ( allNodes , blocks ) )
28812880 } ,
28822881 [ blocks ]
28832882 )
0 commit comments