@@ -601,7 +601,7 @@ async function handleBlockOperationTx(
601601 workflowId : string ,
602602 operation : string ,
603603 payload : any
604- ) : Promise < OperationResult | void > {
604+ ) : Promise < OperationResult | undefined > {
605605 switch ( operation ) {
606606 case BLOCK_OPERATIONS . UPDATE_POSITION : {
607607 if ( ! payload . id || ! payload . position ) {
@@ -1062,7 +1062,7 @@ async function handleBlocksOperationTx(
10621062 workflowId : string ,
10631063 operation : string ,
10641064 payload : any
1065- ) : Promise < OperationResult | void > {
1065+ ) : Promise < OperationResult | undefined > {
10661066 switch ( operation ) {
10671067 case BLOCKS_OPERATIONS . BATCH_UPDATE_POSITIONS : {
10681068 const { updates } = payload
@@ -1631,10 +1631,8 @@ async function handleBlocksOperationTx(
16311631
16321632 const allRemovedEdgeIds : string [ ] = [ ]
16331633 const allAddedEdges : NonNullable < OperationResult [ 'addedEdges' ] > = [ ]
1634+ const applicableUpdates : Array < ( typeof updates ) [ number ] > = [ ]
16341635
1635- // Collect all block IDs being moved in this batch so removeBoundaryEdges
1636- // can treat them as already inside the target container
1637- const allMovingBlockIds = new Set ( updates . map ( ( u : { id : string } ) => u . id ) )
16381636 for ( const update of updates ) {
16391637 const { id, parentId, position } = update
16401638 if ( ! id ) continue
@@ -1662,6 +1660,17 @@ async function handleBlocksOperationTx(
16621660 continue
16631661 }
16641662
1663+ applicableUpdates . push ( update )
1664+ }
1665+
1666+ // Collect only block IDs that will actually be moved in this batch so
1667+ // removeBoundaryEdges can treat them as already inside the target container.
1668+ const allMovingBlockIds = new Set ( applicableUpdates . map ( ( update ) => update . id ) )
1669+
1670+ for ( const update of applicableUpdates ) {
1671+ const { id, parentId, position } = update
1672+ if ( ! id ) continue
1673+
16651674 const isRemovingFromParent = ! parentId
16661675
16671676 // Get current data and position
0 commit comments