Issue #2493💬 AnsweredOpened January 7, 2020by andrewryan19060 reactions

Invalid array length when dragging component onto canvas

Quick answerby andrewryan1906

Here's another clue... once the canvas "breaks" (which I can reliable make happen by refreshing the page and forcing a load... this behavior doesn't happen on new templates, only when the template is loaded from my custom storage, but I verified the JSON hasn't been corrupted), if I take a component and drag it over t...

Read full answer below ↓

Question

Not sure why, But all of a sudden, when I start dragging components onto a canvas, I get this: This seems to happen when I edit a template, save it, and reload it. It also seems to happen when I try to drag a new component to the LAST element of the page; if I try to drag and element inside of a DIV container inside the template, it's fine. But if I try to drag it at the beginning of the template, I get the duplicate items I referenced in #2494 . I have a feeling this is related; somewhere there's a null array that's not supposed to be null. WIthout trying to erect an entire sandbox to repro...

Answers (2)

andrewryan1906January 7, 2020

Here's another clue... once the canvas "breaks" (which I can reliable make happen by refreshing the page and forcing a load... this behavior doesn't happen on new templates, only when the template is loaded from my custom storage, but I verified the JSON hasn't been corrupted), if I take a componen...

andrewryan1906January 7, 2020

OK, I managed to stick grapes.js into my Angular project and reference it instead of the minified version, so I could get more insight into what is going on. The problem seems to be in Sorter.js. The findPosition method is tasked with figuring out which element the cursor is hovering over. For some...

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.