cat-qw-lib 0.28.0 → 0.28.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -595,10 +595,18 @@ class BaseControlComponent {
595
595
  }
596
596
  addToAttributeList() {
597
597
  if (this.attributeModel) {
598
- if (!BaseControlComponent.allAttributes.some(attr => (attr.name === this.attributeModel.name && attr.displayText === this.attributeModel.displayText))) {
599
- BaseControlComponent.allAttributes.push(this.attributeModel);
598
+ // Ensure allAttributes is a mutable array
599
+ if (!Array.isArray(BaseControlComponent.allAttributes)) {
600
+ BaseControlComponent.allAttributes = [];
600
601
  }
601
- this.baseStore.setAttributeModelList(BaseControlComponent.allAttributes);
602
+ if (!BaseControlComponent.allAttributes.some(attr => attr.name === this.attributeModel.name && attr.displayText === this.attributeModel.displayText)) {
603
+ // Create a new array to avoid modifying a frozen array
604
+ BaseControlComponent.allAttributes = [...BaseControlComponent.allAttributes, { ...this.attributeModel }];
605
+ }
606
+ console.log(Object.isExtensible(BaseControlComponent.allAttributes)); // Should return true
607
+ console.log(Object.isFrozen(BaseControlComponent.allAttributes)); // Should return false
608
+ console.log(BaseControlComponent.allAttributes);
609
+ this.baseStore.setAttributeModelList([...BaseControlComponent.allAttributes]);
602
610
  }
603
611
  }
604
612
  // handleEnterKey(event:any, valid: boolean|null) {