mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Fix problems in map card when hours_to_show is 0 (#15900)
This commit is contained in:
parent
7c62b08fdd
commit
da2de3c7d2
@ -33,6 +33,7 @@ import {
|
|||||||
HistoryStates,
|
HistoryStates,
|
||||||
subscribeHistoryStatesTimeWindow,
|
subscribeHistoryStatesTimeWindow,
|
||||||
} from "../../../data/history";
|
} from "../../../data/history";
|
||||||
|
import { hasConfigOrEntitiesChanged } from "../common/has-changed";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
import { findEntities } from "../common/find-entities";
|
import { findEntities } from "../common/find-entities";
|
||||||
import { processConfigEntities } from "../common/process-config-entities";
|
import { processConfigEntities } from "../common/process-config-entities";
|
||||||
@ -187,7 +188,7 @@ class HuiMapCard extends LitElement implements LovelaceCard {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return hasConfigOrEntitiesChanged(this, changedProps);
|
||||||
}
|
}
|
||||||
|
|
||||||
public connectedCallback() {
|
public connectedCallback() {
|
||||||
@ -203,7 +204,11 @@ class HuiMapCard extends LitElement implements LovelaceCard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _subscribeHistory() {
|
private _subscribeHistory() {
|
||||||
if (!isComponentLoaded(this.hass!, "history") || this._subscribed) {
|
if (
|
||||||
|
!isComponentLoaded(this.hass!, "history") ||
|
||||||
|
this._subscribed ||
|
||||||
|
!(this._config?.hours_to_show ?? DEFAULT_HOURS_TO_SHOW)
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._subscribed = subscribeHistoryStatesTimeWindow(
|
this._subscribed = subscribeHistoryStatesTimeWindow(
|
||||||
@ -324,7 +329,7 @@ class HuiMapCard extends LitElement implements LovelaceCard {
|
|||||||
config: MapCardConfig,
|
config: MapCardConfig,
|
||||||
history?: HistoryStates
|
history?: HistoryStates
|
||||||
): HaMapPaths[] | undefined => {
|
): HaMapPaths[] | undefined => {
|
||||||
if (!history) {
|
if (!history || !(config.hours_to_show ?? DEFAULT_HOURS_TO_SHOW)) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user