@ascentgl/ads-ui 21.15.1 → 21.15.2

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.
@@ -805,7 +805,9 @@ class AdsCreateTagComponent {
805
805
  }
806
806
  /** @ignore */
807
807
  onTagCreated(tag) {
808
- tag.id = (this.tags[this.tags.length - 1].id + 1).toString(); // Generate a unique id for the tag - uuid is a 3rd party library
808
+ // Generate a unique id - handle empty array case
809
+ const lastId = this.tags.length > 0 ? Number(this.tags[this.tags.length - 1].id) : 0;
810
+ tag.id = (lastId + 1).toString();
809
811
  this.tags.push(tag); // Add the tag to the list of tags
810
812
  this.tagsChange.emit([...this.tags]); // emit the updated array
811
813
  this.tagCreate.emit(tag);