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 Bram Kragten
parent 35aafd45dc
commit 2dd4090db3

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) {