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)
This shows you how to find issues with performances https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/
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)?
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.
Issue #2211
[QUESTIONS] How to set style for pseudo elements (:after and :before)
Hi, I add STATE in style manager :before and :after but all the styles are applied to the component.
Issue #1516
ckeditor 5 [enhancement]
Hey @artf , as described in the following task I made a build of the ckeditor 5 which works with GrapesJS, however some of the functionalit...
Issue #364
Sort How Block Categories are displayed.
Is there a method to set how the categories are shown in the Block tab?
Issue #3265
RenderField in traitView does not handle null or undefined
Hi @artf! Working on the editor on one of my custom traits i had an issue where for some reason that is not important, the createInput was...
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.