diff --git a/src/gridstack.ts b/src/gridstack.ts index dd37a7f54..52e95249a 100644 --- a/src/gridstack.ts +++ b/src/gridstack.ts @@ -2252,7 +2252,7 @@ export class GridStack { this.engine.cleanupNode(node); // removes all internal _xyz values node.grid = this; } - delete node.grid._isTemp; + delete node.grid?._isTemp; dd.off(el, 'drag'); // if we made a copy ('helper' which is temp) of the original node then insert a copy, else we move the original node (#1102) // as the helper will be nuked by jquery-ui otherwise. TODO: update old code path diff --git a/src/utils.ts b/src/utils.ts index e4bd6787f..22eaa88fe 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -111,9 +111,9 @@ export class Utils { /** true if we should resize to content. strict=true when only 'sizeToContent:true' and not a number which lets user adjust */ static shouldSizeToContent(n: GridStackNode | undefined, strict = false): boolean { - return n?.grid && (strict ? - (n.sizeToContent === true || (n.grid.opts.sizeToContent === true && n.sizeToContent === undefined)) : - (!!n.sizeToContent || (n.grid.opts.sizeToContent && n.sizeToContent !== false))); + return n?.grid && (strict ? + (n.sizeToContent === true || (n.grid.opts.sizeToContent === true && n.sizeToContent === undefined)) : + (!!n.sizeToContent || (n.grid.opts.sizeToContent && n.sizeToContent !== false))); } /** returns true if a and b overlap */