Fix reselecting forecast type in weather forecast card editor (#17652)

Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
Erik Montnemery 2023-08-21 13:22:01 +02:00 committed by GitHub
parent 5f015ac9af
commit c76b2fb357
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,6 +58,7 @@ export class HuiWeatherForecastCardEditor
}
if (
!config.forecast_type ||
(config.forecast_type === "legacy" && this._modernForecastSupported()) ||
!this._forecastSupported(config.forecast_type)
) {
let forecastType: string | undefined;
@ -114,6 +115,14 @@ export class HuiWeatherForecastCardEditor
return false;
}
private _modernForecastSupported(): boolean {
return (
this._forecastSupported("daily") ||
this._forecastSupported("hourly") ||
this._forecastSupported("twice_daily")
);
}
private _schema = memoizeOne(
(
localize: LocalizeFunc,