Reinit model's components function
I think this.components(this) will throw the Maximum call stack size exceeded error as you're trying to append the component to itself. Probably you have to try this I'd probably suggest, in this case, to isolate the function to make things more cleaner
Read full answer below ↓Question
Hello guys, I have a custom component with different structure based on prop's value. How can i recall/reinit model's components function on prop change event. Thank you in advance.
Answers (2)
I think this.components(this) will throw the Maximum call stack size exceeded error as you're trying to append the component to itself. Probably you have to try this I'd probably suggest, in this case, to isolate the function to make things more cleaner
Hi @V1cu you can register your listeners inside the init hook like below:
model: {
init() {
this.listenTo(this, 'change:propName', () => this.components(this))
},
}
Cheers!
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2549
[QUESTION] Update component view on property change
Hi everyone, I'm trying to create a component that will update it's view based on a property value My approach is bassed on #1227 and on th...
Issue #2329
[HELP] Canvas clears component rendering after Traits value change event
I have created custom components and blocks, but when value of traits change, the rendered element gets invisible from the canvas until it...
Issue #1341
[Question] How to work with Custom Components
Hello, I have some questions and issues about and with the grapes editorProblem 1 In a component, which class is there extended? Is it real...
Issue #3135
[Help Wanted] How to easily override existing component ?
For example, I want to add a double click event handler on the default video component to open the assets manager. My basic idea was to get...
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 →Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.