Fix potential undefined select element in color picker (#22212)

This commit is contained in:
Paul Bottein 2024-10-03 11:31:36 +02:00 committed by GitHub
parent 8bc0ea5a0b
commit 7d97dbe15b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -33,12 +33,12 @@ export class HaColorPicker extends LitElement {
@property({ type: Boolean }) public disabled = false;
@query("ha-select") private _select!: HaSelect;
@query("ha-select") private _select?: HaSelect;
connectedCallback(): void {
super.connectedCallback();
// Refresh layout options when the field is connected to the DOM to ensure current value displayed
this._select.layoutOptions();
this._select?.layoutOptions();
}
private _valueSelected(ev) {