diff --git a/doc/CHANGES.md b/doc/CHANGES.md index aa2258e28..57cc265ae 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -126,6 +126,10 @@ Change log +## 12.1.1-dev (TBD) +* fix [#3043](https://github.com/gridstack/gridstack.js/issues/3043) fix `opts.animate` again + + ## 12.1.1 (2024-04-28) * fix [#3038](https://github.com/gridstack/gridstack.js/pull/3038) `updateOptions()` fix opts.minRow being undefined diff --git a/src/gridstack.ts b/src/gridstack.ts index 53b1fddca..2b4007d68 100644 --- a/src/gridstack.ts +++ b/src/gridstack.ts @@ -23,7 +23,7 @@ import { import { DDGridStack } from './dd-gridstack'; import { isTouch } from './dd-touch'; import { DDManager } from './dd-manager'; -import { DDElementHost } from './dd-element';/** global instance */ +import { DDElementHost } from './dd-element'; /** global instance */ const dd = new DDGridStack; // 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 { // if we are loading from empty temporarily remove animation const blank = !this.engine.nodes.length; - if (blank) this.setAnimation(false); + const noAnim = blank && this.opts.animate; + if (noAnim) this.setAnimation(false); // see if any items are missing from new layout and need to be removed first if (!blank && addRemove) { @@ -769,8 +770,7 @@ export class GridStack { delete this._ignoreLayoutsNodeChange; delete this.engine.skipCacheUpdate; prevCB ? GridStack.addRemoveCB = prevCB : delete GridStack.addRemoveCB; - // delay adding animation back - if (blank && this.opts?.animate) this.setAnimation(this.opts.animate, true); + if (noAnim) this.setAnimation(true, true); // delay adding animation back return this; }