Issue #3283Opened February 20, 2021by mig84472 reactions

BUG: BlocksView rendering is being called twice

Question

https://github.com/artf/grapesjs/blob/b199083f6a6128ecff41d20865493294f71fe0a1/src/block_manager/view/BlocksView.js#L186

The Block Manager is looking for a rendered property in the model to tell if the view did render already or not but this method doesn't set said property and therefore this function is called twice, once by the resetevent and once ny the Block Manager. A line containing:

this.rendered = true;

Should be added for this to stop happening

Answers (3)

artfMarch 3, 20210 reactions

Yeah, makes sense, thanks

RutujaBadbeMarch 10, 20210 reactions

https://github.com/artf/grapesjs/blob/b199083f6a6128ecff41d20865493294f71fe0a1/src/block_manager/view/BlocksView.js#L186

The Block Manager is looking for a rendered property in the model to tell if the view did render already or not but this method doesn't set said property and therefore this function is called twice, once by the resetevent and once ny the Block Manager. A line containing:

this.rendered = true;

Should be added for this to stop happening

@mig8447 hi! I am facing the similar issue. The function from script of component is getting called twice. Can you please explain where should I need to add 'this.rendered = true' ?

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.