Invalid array length when dragging component onto canvas
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 outside of my application, any quick thoughts on what might be causing this?
Any ideas on things I could do to track down the problem?
Answers (2)
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 the canvas, it creates "ghost" copies of the component, even though I haven't dropped it. Every time I hover to the top of the canvas, a new ghost component is created - again, even though I haven't dropped. Image below:

Any thoughts welcome, thanks!
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 reason, this line of code:
result.indexEl = dim[6]; // If it's not in flow (like 'float' element)
Is coming back NaN. This is tricking all the way through the code and causing an invalid array length.
When I look at the dims, which is a two dimensional array with all of - I guess? - the dimensions of the components on the canvas, I see:

So... this is interesting. What I'm guessing is happening is that whatever's causing #2494, is creating a ghost component that has no location... and thus is causing THIS error.
I'll leave this ticket open but add my findings to #2494.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3315
mm or cm Units are converted to px
I realized that mm or cm units are converted to px. How can i solve this problem? Thank you
Issue #3253
BUG: How does the property color changes to blue when value changed?
Hi, We are encountering an issue - color of property name such as "Width" is blue when dragging a new component to canvas, but we don't mod...
Issue #2972
FEAT: Disable scripts on canvas
Hello, first of all thanks for a great tool. On my project i hit the problem where I need to disable scripts inside the editor. I found 2 s...
Issue #1723
[QUESTION] replacing particular text in dropped component
Hi, I get the value from custom traits from what I entered but I don't know how to change the particular value in dropped component and ren...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.