Skip to content

fix: detach resize-handle document listeners on destroy before move threshold - #3346

Open
patrykskrzyniarz wants to merge 1 commit into
gridstack:masterfrom
patrykskrzyniarz:fix/resizable-handle-listener-leak
Open

fix: detach resize-handle document listeners on destroy before move threshold#3346
patrykskrzyniarz wants to merge 1 commit into
gridstack:masterfrom
patrykskrzyniarz:fix/resizable-handle-listener-leak

Conversation

@patrykskrzyniarz

Copy link
Copy Markdown

Summary

  • Fixes a listener leak in DDResizableHandle.destroy(): document mousemove/mouseup listeners attached on mousedown were only removed when this.moving was true (after the 3px threshold).
  • A handle destroyed between mousedown and that threshold left orphaned listeners that then threw Cannot read properties of undefined (reading 'gridstackNode') on every subsequent mouse event until reload.
  • Guard on this.mouseDownEvent instead — same pattern as DDDraggable.destroy().

Fixes #3345

Test plan

  • Init a resizable grid, mousedown on a .ui-resizable-handle without moving >3px, then call removeAll() / disable() / destroy() while still held
  • Move the mouse — no gridstackNode TypeError, no repeating errors on later mouse events
  • Normal resize still works (mousedown → drag past 3px → mouseup)
  • Esc during an in-progress resize still cancels cleanly

Made with Cursor

…hreshold

DDResizableHandle.destroy() only called _mouseUp when moving was true, so a
handle torn down between mousedown and the 3px threshold left document
mousemove/mouseup listeners attached and threw on every subsequent mouse event.
Guard on mouseDownEvent instead, matching DDDraggable.destroy().

Fixes gridstack#3345

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resize handle leaks document mouse listeners when destroyed before the 3px threshold (throws on every mouse event until reload)

1 participant