Skip to content

Commit

Permalink
fix(chip-group): Add existence checks (#7487)
Browse files Browse the repository at this point in the history
## Summary
Running into some error using Chip Group / Chip in React environment
with programmatically populated Chips...

![Screenshot 2023-08-08 at 10 45 44
AM](https://github.com/Esri/calcite-design-system/assets/4733155/b8f1a301-b317-4d22-92f2-e4fd269d30a9)
![Screenshot 2023-08-08 at 10 33 17
AM](https://github.com/Esri/calcite-design-system/assets/4733155/b3c2e3dd-2253-4c43-8130-b8ca73bf0a1f)

Adds check for existence of unfound element.
  • Loading branch information
macandcheese committed Aug 8, 2023
1 parent 864f7f7 commit 33225a7
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@ export class ChipGroup implements InteractiveComponent {
private updateItems = (event?: Event): void => {
const target = event ? (event.target as HTMLSlotElement) : this.slotRefEl;
this.items = target
.assignedElements({ flatten: true })
?.assignedElements({ flatten: true })
.filter((el) => el?.matches("calcite-chip")) as HTMLCalciteChipElement[];

this.items.forEach((el) => {
this.items?.forEach((el) => {
el.interactive = true;
el.scale = this.scale;
el.selectionMode = this.selectionMode;
Expand Down

0 comments on commit 33225a7

Please sign in to comment.