Skip to content

save(false, true) followed by enable() throws error "Uncaught TypeError" #1793

@cfcoder

Description

@cfcoder

Subject of the issue

Use of the enable and disable methods in conjunction with use of the save method produces an error

Your environment

  • version of gridstack.js "gridstack@4.2.5" using HTML5 version
  • which browser/OS Brave Version 1.25.73 Chromium: 91.0.4472.106 (Official Build) (64-bit)

Steps to reproduce

Using your base template, I add these 4 additional lines of code at the bottom (after the two addNewWidget() lines):

grid.enable();
grid.save(false, true); // causes error at the end
grid.disable();
grid.enable();

Simply run your base code with those 4 added lines. Script error occurs.

Expected behavior

No error

Actual behavior

Error occurs in console when the final (of 4 added lines) line of enable() runs, it throws this error:

dd-draggable.ts:68 Uncaught TypeError: Cannot read property 'substring' of undefined
at new n (dd-draggable.ts:68)
at n.setupDraggable (dd-element.ts:55)
at gridstack-dd-native.ts:57
at Array.forEach ()
at l.draggable (gridstack-dd-native.ts:48)
at a.o.GridStack._prepareDragDropByNode (gridstack-dd.ts:435)
at gridstack-dd.ts:620
at Array.forEach ()
at a.o.GridStack.movable (gridstack-dd.ts:616)
at gridstack-dd.ts:679

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions