mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-12 20:06:33 +00:00
Guard calling input select row with bad option (#12181)
This commit is contained in:
parent
ba8b20d877
commit
419d659311
@ -13,6 +13,7 @@ import { computeStateName } from "../../../common/entity/compute_state_name";
|
|||||||
import "../../../components/ha-select";
|
import "../../../components/ha-select";
|
||||||
import { UNAVAILABLE } from "../../../data/entity";
|
import { UNAVAILABLE } from "../../../data/entity";
|
||||||
import { forwardHaptic } from "../../../data/haptics";
|
import { forwardHaptic } from "../../../data/haptics";
|
||||||
|
import type { InputSelectEntity } from "../../../data/input_select";
|
||||||
import { SelectEntity, setSelectOption } from "../../../data/select";
|
import { SelectEntity, setSelectOption } from "../../../data/select";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
import { EntitiesCardEntityConfig } from "../cards/types";
|
import { EntitiesCardEntityConfig } from "../cards/types";
|
||||||
@ -106,9 +107,14 @@ class HuiSelectEntityRow extends LitElement implements LovelaceRow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _selectedChanged(ev): void {
|
private _selectedChanged(ev): void {
|
||||||
const stateObj = this.hass!.states[this._config!.entity];
|
const stateObj = this.hass!.states[
|
||||||
|
this._config!.entity
|
||||||
|
] as InputSelectEntity;
|
||||||
const option = ev.target.value;
|
const option = ev.target.value;
|
||||||
if (option === stateObj.state) {
|
if (
|
||||||
|
option === stateObj.state ||
|
||||||
|
!stateObj.attributes.options.includes(option)
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user