Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9b6c68f

Browse files
fix issue on failed drag makes the whole grid unresponsive (#2672)
* fix issue on failed drag, shouldn't throw an error * move the code to orinal position, use optional chaining instead
1 parent 44b5a72 commit 9b6c68f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/gridstack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2252,7 +2252,7 @@ export class GridStack {
22522252
this.engine.cleanupNode(node); // removes all internal _xyz values
22532253
node.grid = this;
22542254
}
2255-
delete node.grid._isTemp;
2255+
delete node.grid?._isTemp;
22562256
dd.off(el, 'drag');
22572257
// if we made a copy ('helper' which is temp) of the original node then insert a copy, else we move the original node (#1102)
22582258
// as the helper will be nuked by jquery-ui otherwise. TODO: update old code path

src/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ export class Utils {
111111

112112
/** true if we should resize to content. strict=true when only 'sizeToContent:true' and not a number which lets user adjust */
113113
static shouldSizeToContent(n: GridStackNode | undefined, strict = false): boolean {
114-
return n?.grid && (strict ?
115-
(n.sizeToContent === true || (n.grid.opts.sizeToContent === true && n.sizeToContent === undefined)) :
116-
(!!n.sizeToContent || (n.grid.opts.sizeToContent && n.sizeToContent !== false)));
114+
return n?.grid && (strict ?
115+
(n.sizeToContent === true || (n.grid.opts.sizeToContent === true && n.sizeToContent === undefined)) :
116+
(!!n.sizeToContent || (n.grid.opts.sizeToContent && n.sizeToContent !== false)));
117117
}
118118

119119
/** returns true if a and b overlap */

0 commit comments

Comments
 (0)