Browse Source

Fix falsy value being treated as undefined

pull/6359/head
mohamedsalem401 1 year ago
parent
commit
b7d27936f9
  1. 1
      packages/core/src/data_sources/model/collection_component/CollectionComponent.ts
  2. 2
      packages/core/src/dom_components/model/Component.ts

1
packages/core/src/data_sources/model/collection_component/CollectionComponent.ts

@ -67,7 +67,6 @@ export default class CollectionComponent extends Component {
private getBlockDefinition() {
const firstChild = this.components().at(0)?.toJSON() || {};
console.log('🚀 ~ CollectionComponent ~ getBlockDefinition ~ firstChild:', firstChild);
return firstChild;
}

2
packages/core/src/dom_components/model/Component.ts

@ -978,7 +978,7 @@ export default class Component extends StyleableModel<ComponentProperties> {
const value = trait.getInitValue();
if (trait.changeProp) {
!this.get(name) && this.set(name, value);
isUndefined(this.get(name)) && this.set(name, value);
} else {
if (name && value) attrs[name] = value;
}

Loading…
Cancel
Save