Improved the metadata setter of the client vc item

This commit is contained in:
Alejandro Gallardo Escobar 2019-07-16 16:24:08 +02:00
parent 39d02db364
commit 078286a10f
1 changed files with 6 additions and 3 deletions

View File

@ -601,14 +601,17 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
}
/**
* Clasic and protected version of the setter of the `meta` property.
* Classic version of the setter of the `meta` property.
* Useful to override it from children classes.
* @param newProps
*/
protected setMeta(newMetadata: ItemMeta) {
public setMeta(newMetadata: Partial<ItemMeta>): void {
const prevMetadata = this._metadata;
// Update the internal meta.
this._metadata = newMetadata;
this._metadata = {
...prevMetadata,
...newMetadata
};
// From this point, things which rely on this.props can access to the changes.