Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
cfcoder opened this issue Jun 23, 2021 · 1 comment · Fixed by #1809
Closed

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

cfcoder opened this issue Jun 23, 2021 · 1 comment · Fixed by #1809

Comments

@cfcoder
Copy link

cfcoder commented Jun 23, 2021

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

@adumesny
Copy link
Member

fixed in next release. don't forget to contribute if you find lib useful!

adumesny added a commit to adumesny/gridstack.js that referenced this issue Oct 3, 2021
fix gridstack#1860 which was caused by gridstack#1793
* cloneDeep() will now skip clonning internal known objects we don't serialize (and delete later with removeInternalAndSame())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants