You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Drag Item B to swap with Item A, then move them directly out of the yellow area.
Get an error message
gridstack-all.js:2 Uncaught RangeError: Maximum call stack size exceeded
at t.get (gridstack-all.js:2:34331)
at t._useEntireRowArea (gridstack-all.js:2:31070)
at t._fixCollisions (gridstack-all.js:2:31397)
at t.moveNode (gridstack-all.js:2:41080)
at t._fixCollisions (gridstack-all.js:2:31912)
at t.moveNode (gridstack-all.js:2:41080)
at t._fixCollisions (gridstack-all.js:2:31912)
at t.moveNode (gridstack-all.js:2:41080)
at t._fixCollisions (gridstack-all.js:2:31912)
at t.moveNode (gridstack-all.js:2:41080)
If I set acceptWidgets: false and repeat the steps above, the error does not occur.
Expected behavior
When swapping Item B and Item A, the items should successfully change positions, and even if I drag them out of the yellow area, it shouldn't cause an error.
Additional details
I tried modifying the original code and found that when I set acceptWidgets: false, the dropout event doesn't trigger. However, when set to true, it enters the following block of code:
// gridstack.js/src/gridstack.ts.on(this.el,'dropout',(event,el: GridItemHTMLElement,helper: GridItemHTMLElement)=>{// *************************************************console.log("acceptWidgets === true will show this");if(this.opts.acceptWidgets===true)returnfalse;// *************************************************// console.log(`out ${this.el.gridstack.opts.id} ${count++}`); // TESTconstnode=helper?.gridstackNode||el.gridstackNode;if(!node)returnfalse;// fix #1578 when dragging fast, we might get leave after another grid gets entered (which calls us to clean)// so skip this one if we're not the active grid really..if(!node.grid||node.grid===this){this._leave(el,helper);// if we were created as temporary nested grid, revert to the previous stateif(this._isTemp){this.removeAsSubGrid(node);}}returnfalse;// prevent parent from receiving message (which may also be grid)})
When acceptWidgets: false is set, the following console.log does not display
When acceptWidgets: true is set, the following console.log is displayed and get error message
When acceptWidgets: true is set, I added if(this.opts.acceptWidgets === true) return false; the error doesn't occur.
Thanks
The text was updated successfully, but these errors were encountered:
Subject of the issue
Original discussion thread
https://gridstackjs.slack.com/archives/C0LPPLXJR/p1735744953594099?thread_ts=1735236074.058529&cid=C0LPPLXJR
I use the example Website demo 1
Drag causes an error when acceptWidgets: true is set, but not when it is set to false. You can refer to the explanation below for more details
Your environment
gridstack.js - v11.2.0
browser: Chrome 131.0.6778.205
Steps to reproduce
reproduce example: https://codesandbox.io/p/sandbox/tg9zg4
2025-01-05.12.46.37.mov
Item B
to swap withItem A
, then move them directly out of the yellow area.If I set
acceptWidgets: false
and repeat the steps above, the error does not occur.Expected behavior
When swapping Item B and Item A, the items should successfully change positions, and even if I drag them out of the yellow area, it shouldn't cause an error.
Additional details
I tried modifying the original code and found that when I set acceptWidgets: false, the dropout event doesn't trigger. However, when set to true, it enters the following block of code:
When
acceptWidgets: false
is set, the followingconsole.log
does not displayWhen
acceptWidgets: true
is set, the followingconsole.log
is displayed and get error messageWhen
acceptWidgets: true
is set, I addedif(this.opts.acceptWidgets === true) return false;
the error doesn't occur.Thanks
The text was updated successfully, but these errors were encountered: