Add guard to fix overlapping regional forecast icons after a period of time

This commit is contained in:
mrkmntal 2026-04-12 13:13:15 -04:00
commit a23eb483ea

View file

@ -21,6 +21,7 @@ class RegionalForecast extends WeatherDisplay {
this.locationMarker = null;
this.nearbyMarkers = [];
this.nearbyMarkersKey = '';
this.refreshingMarkers = false;
}
async getData(weatherParameters, refresh) {
@ -54,8 +55,11 @@ class RegionalForecast extends WeatherDisplay {
}
async refreshNearbyMarkers() {
if (!this.map || !this.active) return;
if (!this.map || !this.active || this.refreshingMarkers) return;
this.refreshingMarkers = true;
try {
this.map.invalidateSize(false);
this.map.setView([this.weatherParameters.latitude, this.weatherParameters.longitude], 6);
@ -78,6 +82,9 @@ class RegionalForecast extends WeatherDisplay {
});
this.nearbyMarkers.forEach((marker) => marker.addTo(this.map));
this.nearbyMarkersKey = markerKey;
} finally {
this.refreshingMarkers = false;
}
}
async ensureMap() {