When adding components to the canvas, duplicates are created in the DOM (but not the model)
OK, as far as I can tell the problem is in Sorter.js and centers around this code: This code is called by onMove any time you start to drag a component onto the canvas. I see that you create temporary component, and then immediately remove it on the next line. The problem is in this block of code: For some reason... w...
Read full answer below ↓Question
When I drag a component - say a Map - onto the canvas, it now creates three copies of that element in the DOM. However, the model is correct, and if I refresh the screen, it renders correctly.
Without trying to erect an entire sandbox to reproduce, any quick thoughts on what might be causing this?
Thanks, Andrew
Answers (3)
OK, as far as I can tell the problem is in Sorter.js and centers around this code: This code is called by onMove any time you start to drag a component onto the canvas. I see that you create temporary component, and then immediately remove it on the next line. The problem is in this block of code:...
This entire problem disappears when I remove this line from my configuration init:
domComponents: {
...
storeWrapper: true,
},
Something about that setting causes this behavior. Still don't understand what.
Thanks @andrewryan1906 for all the insights, actually the Sorter file was in my to refactor list for a while now but didn't yet find the time to handle it... Anyway I'm still confused about what is going on, for sure I need you to create a reproducible demo otherwise I'm not able to help... and one...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1906
Components & Js - Load Template
Hey, I have a component which has a JS attached to it. Everything is created using the JS. When I drag and drop my block for the first time...
Issue #1696
Traits appear first time when draged custom component
Hi artf , i have created custom component and add traits for it , when dragging this component to editor and select it the setting traits w...
Issue #1888
[Question] Add custom html inside canvas
Hi there, I'm using grapes to export a custom json with all the information i need, instead of HTML and CSS. For doing that I'm parsing the...
Issue #1493
[QUESTION] render() works on the first time but not on subsequent calls
Hello, I've created a custom component that shows images using background-image on a <div> instead of using an <img> element. It's mostly w...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →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.