Fix bug in ground, hazard and latest observation views where they could not be hidden

This commit is contained in:
mrkmntal 2026-08-21 13:13:43 -04:00
commit d120c27b6e
3 changed files with 8 additions and 11 deletions

View file

@ -12,12 +12,11 @@ class GroundView extends WeatherDisplay {
} }
async getData(weatherParameters, refresh) { async getData(weatherParameters, refresh) {
const superResult = super.getData(weatherParameters, refresh); if (!super.getData(weatherParameters, refresh)) return;
this.setAutoReload();
const requestToken = ++this.requestToken; const requestToken = ++this.requestToken;
if (!this.weatherParameters?.latitude || !this.weatherParameters?.longitude || !this.weatherParameters?.city) { if (!this.weatherParameters?.latitude || !this.weatherParameters?.longitude || !this.weatherParameters?.city) {
this.setStatus(STATUS.noData); this.setStatus(STATUS.noData);
return superResult; return;
} }
const url = new URL(withBasePath('api/ground-view'), window.location.origin); const url = new URL(withBasePath('api/ground-view'), window.location.origin);
@ -30,13 +29,13 @@ class GroundView extends WeatherDisplay {
}); });
if (requestToken !== this.requestToken) { if (requestToken !== this.requestToken) {
return superResult; return;
} }
if (!response?.success) { if (!response?.success) {
this.data = null; this.data = null;
this.setStatus(STATUS.failed); this.setStatus(STATUS.failed);
return superResult; return;
} }
this.data = { this.data = {
@ -44,7 +43,6 @@ class GroundView extends WeatherDisplay {
hasWebcam: Boolean(response.webcam?.imageUrl), hasWebcam: Boolean(response.webcam?.imageUrl),
}; };
this.setStatus(STATUS.loaded); this.setStatus(STATUS.loaded);
return superResult;
} }
resetViewState() { resetViewState() {

View file

@ -13,12 +13,12 @@ class HazardList extends WeatherDisplay {
} }
async getData(weatherParameters, refresh) { async getData(weatherParameters, refresh) {
const superResult = super.getData(weatherParameters, refresh); if (!super.getData(weatherParameters, refresh)) return;
await this.refreshHistoryNow(); await this.refreshHistoryNow();
return superResult;
} }
async refreshHistoryNow() { async refreshHistoryNow() {
if (!this.isEnabled) return;
try { try {
// Fetch hazard history from backend // Fetch hazard history from backend
const response = await fetch(withBasePath('api/hazard-history')); const response = await fetch(withBasePath('api/hazard-history'));

View file

@ -17,14 +17,13 @@ class LatestObservations extends WeatherDisplay {
} }
async getData(weatherParameters, refresh) { async getData(weatherParameters, refresh) {
const superResult = super.getData(weatherParameters, refresh); if (!super.getData(weatherParameters, refresh)) return;
this.data = await parseData(this.weatherParameters); this.data = await parseData(this.weatherParameters);
if (!this.data) { if (!this.data) {
this.setStatus(STATUS.failed); this.setStatus(STATUS.failed);
return superResult; return;
} }
this.setStatus(STATUS.loaded); this.setStatus(STATUS.loaded);
return superResult;
} }
async drawCanvas() { async drawCanvas() {