Fix maps card with location sources (#16778)

This commit is contained in:
Bram Kragten 2023-06-05 15:53:57 +02:00 committed by GitHub
parent 1bf03f020e
commit 29c564bb69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 3 deletions

View File

@ -34,7 +34,10 @@ import {
HistoryStates,
subscribeHistoryStatesTimeWindow,
} from "../../../data/history";
import { hasConfigOrEntitiesChanged } from "../common/has-changed";
import {
hasConfigChanged,
hasConfigOrEntitiesChanged,
} from "../common/has-changed";
import { HomeAssistant } from "../../../types";
import { findEntities } from "../common/find-entities";
import { processConfigEntities } from "../common/process-config-entities";
@ -194,7 +197,15 @@ class HuiMapCard extends LitElement implements LovelaceCard {
return true;
}
return hasConfigOrEntitiesChanged(this, changedProps);
if (this._config?.geo_location_sources) {
if (oldHass.states !== this.hass.states) {
return true;
}
}
return this._config?.entities
? hasConfigOrEntitiesChanged(this, changedProps)
: hasConfigChanged(this, changedProps);
}
public connectedCallback() {

View File

@ -4,7 +4,10 @@ import { EntityRegistryDisplayEntry } from "../../../data/entity_registry";
import { HomeAssistant } from "../../../types";
import { processConfigEntities } from "./process-config-entities";
function hasConfigChanged(element: any, changedProps: PropertyValues): boolean {
export function hasConfigChanged(
element: any,
changedProps: PropertyValues
): boolean {
if (changedProps.has("_config")) {
return true;
}