@@ -366,7 +366,7 @@ export class BlockDragStrategy implements IDragStrategy {
366366 } ;
367367 }
368368
369- this . startChildConn = nextTargetConn ;
369+ this . startChildConn = nextTargetConn ?? null ;
370370 }
371371 }
372372 }
@@ -627,7 +627,7 @@ export class BlockDragStrategy implements IDragStrategy {
627627 draggingBlock . outputConnection ,
628628 draggingBlock . previousConnection ,
629629 draggingBlock . nextConnection ,
630- ] . filter ( Boolean ) ; // Removes falsy (null) values.
630+ ] . filter ( ( c ) => ! ! c ) ; // Removes falsy (null) values.
631631 const inputConnections : RenderedConnection [ ] = [ ] ;
632632
633633 for ( const conn of available ) {
@@ -727,14 +727,20 @@ export class BlockDragStrategy implements IDragStrategy {
727727 this . connectionPreviewer ?. hidePreview ( ) ;
728728 this . connectionCandidate = null ;
729729
730- this . startChildConn ?. connect ( this . block . nextConnection ) ;
730+ if ( this . block . nextConnection ) {
731+ this . startChildConn ?. connect ( this . block . nextConnection ) ;
732+ }
731733 if ( this . startParentConn ) {
732734 switch ( this . startParentConn . type ) {
733735 case ConnectionType . INPUT_VALUE :
734- this . startParentConn . connect ( this . block . outputConnection ) ;
736+ if ( this . block . outputConnection ) {
737+ this . startParentConn . connect ( this . block . outputConnection ) ;
738+ }
735739 break ;
736740 case ConnectionType . NEXT_STATEMENT :
737- this . startParentConn . connect ( this . block . previousConnection ) ;
741+ if ( this . block . previousConnection ) {
742+ this . startParentConn . connect ( this . block . previousConnection ) ;
743+ }
738744 }
739745 } else {
740746 this . block . moveTo ( this . startLoc ! , [ 'drag' ] ) ;
0 commit comments