HealthCatalyst / Fabric.Cashmere

Health Catalyst’s comprehensive design system.
http://cashmere.healthcatalyst.net
Apache License 2.0
66 stars 76 forks source link

SelectComponent: Value resets when options change #2209

Closed isaaclyman closed 1 year ago

isaaclyman commented 1 year ago

Summary

When you change the options on an hc-select, the selected option no longer matches the form control's (or ngModel's) value in Angular.

Reproduction

Steps to reproduce:

  1. Create an hc-select and use a *ngFor to populate options. Set the hc-select's value using a formControl or ngModel, but set it with a primitive value (like a numeric id).
  2. Select any option other than the first one.
  3. Programmatically change the list used by the *ngFor. Make sure one of the new items in the list has the same id as the option you've selected.
  4. The select resets to the first option in the list, even though the value of the hc-select matches the id of one of the other options.

Stackblitz reproduction: https://stackblitz.com/edit/angular-9fzydn?file=src%2Fapp%2Fselect-forms%2Fselect-forms-example.component.ts

Additional context

This might be a different manifestation of the same bug reported in #2207.

health-catalyst commented 1 year ago

:tada: This issue has been resolved in version 15.1.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: