Fix number selector display for 0 (#18927)

This commit is contained in:
karwosts 2023-12-06 08:03:44 -08:00 committed by GitHub
parent 39260d172f
commit a820ca1e90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,9 +30,9 @@ export class HaNumberSelector extends LitElement {
protected willUpdate(changedProps: PropertyValues) {
if (changedProps.has("value")) {
if (this.value !== Number(this._valueStr)) {
if (this._valueStr === "" || this.value !== Number(this._valueStr)) {
this._valueStr =
!this.value || isNaN(this.value) ? "" : this.value.toString();
this.value == null || isNaN(this.value) ? "" : this.value.toString();
}
}
}