Issue #3061💬 AnsweredOpened October 2, 2020by timramseyjr0 reactions

Adding changeProp: 1 to trait causes trait changes to not propagate to remote Storage

快速解答by artf

changeProp in this case updates the component property and being custom is not tracked. As a workaround you can propagate them in this way (in your custom component model)

Read full answer below ↓

Question

Version: 0.16.22

What is the expected behavior?

changing Trait property(columns in demo) should trigger POST to remote storage regardless of changeProp

traits: [
	{
		label: 'Columns(Change doesn't POST)',
		name: 'columns-not-changing',
		changeProp: 1,
		type: 'number'
	},
	{
		label: 'Columns(Change does POST)',
		name: 'columns',
		type: 'number'
	}
]

https://jsfiddle.net/tntramsey/vgbeLarj/3/ - changing columns on the 'Test Plugin' initiates a POST to the remote storage https://jsfiddle.net/tntramsey/n7tgojhy/4/ - Adding changeProp: 1 to the trait and changing Columns does not POST to remote storage

Answers (1)

artfOctober 10, 2020

changeProp in this case updates the component property and being custom is not tracked. As a workaround you can propagate them in this way (in your custom component model)

...
init() {
  ...
  this.on('change:columns-not-changing', (...args) => editor.getModel().handleUpdates(...args))
}

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

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

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.