Components 'add' event fires different number of times
Hi @maxtacco, unfortunately, this is due to how the Sorter works when moves components and honestly, at the moment, I can't see better workaround than your one
Read full answer below ↓Question
Hi, I've noticed that if I add the following code in my custom component the event fires differently depending on whether a new child component is drag and dropped from blocks vs canvas. Only one event is fired when I drag and drop a child component from the blocks section. But, when I drag and drop from canvas I can see this event firing twice and the first time some 'div' component is passed. I wonder if this relates to https://github.com/artf/grapesjs/pull/202 or not. Also, I can handle this event the way I want but checking for the avoidStore option of the component: Please let me know if...
Answers (2)
Hi @maxtacco, unfortunately, this is due to how the Sorter works when moves components and honestly, at the moment, I can't see better workaround than your one
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1815
[Bug]: component:mount is fired multiple times
I had been using editor events and I noticed that component:mount event fires multiple times when a component is dragged from blocks to can...
Issue #1895
[QUESTION] Drag component over canvas with script, script appended multiple times.
Hi, not sure if this is a bug or not. But I noticed a weird behavior, when I drag a block that has a component that contains a script funct...
Issue #1727
[QUESTION] Event to get children view
I have a problem with a component. When I drop a component into the canvas I create a simple object. Before appending this object I need to...
Issue #1951
[QUESTIONS] change or add event on add component from block
is it possible ?, change the drag and drop event to on click when adding a new component, I want to add components by clicking the block th...
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 →Related tutorials
In-depth guides on the same topic.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.