Skip to content

Commit 3dd3266

Browse files
committed
fix: makeWidget breakpoint layout issue
1 parent b839db9 commit 3dd3266

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/gridstack-engine.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,14 +417,14 @@ export class GridStackEngine {
417417
// remember it's position & width so we can restore back (1 -> 12 column) #1655 #1985
418418
// IFF we're not in the middle of column resizing!
419419
const saveOrig = (node.x || 0) + (node.w || 1) > this.column;
420-
if (saveOrig && this.column < this.defaultColumn && !this._inColumnResize && !this.skipCacheUpdate && node._id && this.findCacheLayout(node, this.defaultColumn) === -1) {
420+
if (saveOrig && this.column < this.defaultColumn && !this._inColumnResize && !this.skipCacheUpdate && !isNaN(node._id) && this.findCacheLayout(node, this.defaultColumn) === -1) {
421421
const copy = {...node}; // need _id + positions
422422
if (copy.autoPosition || copy.x === undefined) { delete copy.x; delete copy.y; }
423423
else copy.x = Math.min(this.defaultColumn - 1, copy.x);
424424
copy.w = Math.min(this.defaultColumn, copy.w || 1);
425425
this.cacheOneLayout(copy, this.defaultColumn);
426426
}
427-
427+
428428
if (node.w > this.column) {
429429
node.w = this.column;
430430
} else if (node.w < 1) {

src/gridstack.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,7 +1633,9 @@ export class GridStack {
16331633
el.gridstackNode = node;
16341634
node.el = el;
16351635
node.grid = this;
1636+
this.engine._loading = true; // help with collision
16361637
node = this.engine.addNode(node, triggerAddEvent);
1638+
delete this.engine._loading; // done loading
16371639

16381640
// write the dom sizes and class
16391641
this._writeAttr(el, node);

0 commit comments

Comments
 (0)