@@ -23,7 +23,7 @@ import {
2323import { DDGridStack } from './dd-gridstack' ;
2424import { isTouch } from './dd-touch' ;
2525import { DDManager } from './dd-manager' ;
26- import { DDElementHost } from './dd-element' ; /** global instance */
26+ import { DDElementHost } from './dd-element' ; /** global instance */
2727const dd = new DDGridStack ;
2828
2929// export all dependent file as well to make it easier for users to just import the main file
@@ -704,7 +704,8 @@ export class GridStack {
704704
705705 // if we are loading from empty temporarily remove animation
706706 const blank = ! this . engine . nodes . length ;
707- if ( blank ) this . setAnimation ( false ) ;
707+ const noAnim = blank && this . opts . animate ;
708+ if ( noAnim ) this . setAnimation ( false ) ;
708709
709710 // see if any items are missing from new layout and need to be removed first
710711 if ( ! blank && addRemove ) {
@@ -769,8 +770,7 @@ export class GridStack {
769770 delete this . _ignoreLayoutsNodeChange ;
770771 delete this . engine . skipCacheUpdate ;
771772 prevCB ? GridStack . addRemoveCB = prevCB : delete GridStack . addRemoveCB ;
772- // delay adding animation back
773- if ( blank && this . opts ?. animate ) this . setAnimation ( this . opts . animate , true ) ;
773+ if ( noAnim ) this . setAnimation ( true , true ) ; // delay adding animation back
774774 return this ;
775775 }
776776
0 commit comments