Issue #1909Opened March 20, 2019by iggolob1 reactions

SetComponents is sometimes very slow

Question

Hi all We're working on a newsletter app and are using grapesjs as the email editor with the newsletter preset plguin and some custom changes. We store the HTMLs in our database and I noticed that some templates take a very long time to load with the editor.setComponents method.

I tried to load the templates in the demo page through the import and while it loads almost instantly, I did notice a peculiar issue on the newsletter demo page ( https://grapesjs.com/demo-newsletter-editor.html ). If a component is selected before importing a HTML template it takes a lot longer to load (from 0.5s up to 5s).

With inserting some logs I've figured that the backbone set method get's called a lot more. Mostly 'add' models get duplicated, but there are also a lot of 'change:style' models. But I'm kind of at a loss here what is necessary and what not :S Maybe figuring out why setComponents get's a lot slower if a component is selected, could help me figure out why it is also slow in our project.

I've also noticed that this starts happening after release 0.14.40. Any help is greatly appreciated.

Answers (3)

artfMarch 24, 20190 reactions

Hi @iggolob can you provide an example of a template and exact steps to reproduce the issue (talking about the fact is slower when you select a component)?

iggolobMarch 25, 20190 reactions

Hi @artf The news letter demo page can be used to reproduce the issue ( https://grapesjs.com/demo-newsletter-editor.html ). As a template you can use the preset HTML set for the demo page. Just copy the HTML from Export template option. Now if you import that template it should be done almost immediately. But if you select any component, doesn't matter if image, text, cell or table and try to import, then it takes a noticeable long time, like a few seconds. Hopefully this information is sufficient, I can also try to make a video, showing the steps.

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

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.