BlocksView rendering is being called twice
@RutujaBadbe This is the exact change you need: https://github.com/artf/grapesjs/commit/640661b0a44e5e2857b615559c1db27da3e17a6c
Read full answer below ↓Question
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 (4)
@RutujaBadbe This is the exact change you need: https://github.com/artf/grapesjs/commit/640661b0a44e5e2857b615559c1db27da3e17a6c
Yeah, makes sense, thanks
The Block Manager is looking for a
renderedproperty 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 theresetevent 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' ?
Thanks for reporting this, @mig8447.
Thanks for sharing your report about BlocksView rendering is being called twice. To help the team investigate and prioritize this:
Please provide:
- A minimal reproducible example (CodeSandbox/JSFiddle)
- Your GrapesJS version number
- Browser and OS information
- Any error messages from the browser console
- Steps to reproduce the issue
What helps most:
- Minimal code example (not your full project)
- Screen recording or screenshot showing the issue
- Expected vs actual behavior clearly stated
- GrapesJS configuration you're using
With these details, the maintainers can identify and prioritize a fix much faster. The GrapesJS team is very responsive to well-documented issues.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3284
Block rendering is being called twice
https://github.com/artf/grapesjs/blob/b199083f6a6128ecff41d20865493294f71fe0a1/src/block_manager/view/BlocksView.js#L142 This line makes th...
Issue #3274
Block.js `initialize` function is not doing anything
https://github.com/artf/grapesjs/blob/3199d76ba5677229e90f13ef48fb91e9bfe1e90d/src/blockmanager/model/Block.js#L23 As far as I can see, the...
Issue #3367
Modal template
Is there a way for me to modify the template from a compiled state? https://github.com/artf/grapesjs/blob/d3256e621bb43a537213ffcd86b10dc0b...
Issue #3285
[Question]: Doctype in the canvas iframe
Hi. This question has already been asked twice (here and here) but has never got an answer. Is there a way to add <!DOCTYPE html> as the be...
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.