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

When adding components to the canvas, duplicates are created in the DOM (but not the model)

Quick answerby andrewryan1906

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)

andrewryan1906January 7, 2020

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:...

andrewryan1906January 9, 2020

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.

artfJanuary 12, 2020

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.

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.