From 2679fcf7393cfb68d61f2f6efd1b84e417bf646d Mon Sep 17 00:00:00 2001 From: Sam Detweiler Date: Thu, 15 Oct 2020 07:43:32 -0500 Subject: [PATCH 1/2] fix currentweather and weatherforecast show()ing all the time --- CHANGELOG.md | 1 + modules/default/currentweather/currentweather.js | 6 ++++-- modules/default/weatherforecast/weatherforecast.js | 6 ++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3ffaad67d..e381e126f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ _This release is scheduled to be released on 2021-01-01._ - Wrong node-ical version installed (package.json) requested version. (#2153) - Fix calendar fetcher subsequent timing (#2160) - The core is now checking to see if a module is hidden before it calls `getDom()`. This prevents unwanted dom updates. (#2164) +- currentweather and weatherforecast always showing themselves on each update ## [2.13.0] - 2020-10-01 diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js index 0a43b23e6b..f36f3436ce 100644 --- a/modules/default/currentweather/currentweather.js +++ b/modules/default/currentweather/currentweather.js @@ -496,8 +496,10 @@ Module.register("currentweather", { this.sunriseSunsetTime = timeString; this.sunriseSunsetIcon = sunrise < now && sunset > now ? "wi-sunset" : "wi-sunrise"; - this.show(this.config.animationSpeed, { lockString: this.identifier }); - this.loaded = true; + if (!this.loaded) { + this.show(this.config.animationSpeed, { lockString: this.identifier }); + this.loaded = true; + } this.updateDom(this.config.animationSpeed); this.sendNotification("CURRENTWEATHER_DATA", { data: data }); }, diff --git a/modules/default/weatherforecast/weatherforecast.js b/modules/default/weatherforecast/weatherforecast.js index 4ecc18aae9..38aa1ca67a 100644 --- a/modules/default/weatherforecast/weatherforecast.js +++ b/modules/default/weatherforecast/weatherforecast.js @@ -408,8 +408,10 @@ Module.register("weatherforecast", { } //Log.log(this.forecast); - this.show(this.config.animationSpeed, { lockString: this.identifier }); - this.loaded = true; + if (!this.loaded) { + this.show(this.config.animationSpeed, { lockString: this.identifier }); + this.loaded = true; + } this.updateDom(this.config.animationSpeed); }, From 8b8e354333802b9a8790312ff922b7ca469dea27 Mon Sep 17 00:00:00 2001 From: Sam Detweiler Date: Thu, 15 Oct 2020 07:54:09 -0500 Subject: [PATCH 2/2] fix updateDom empty promise --- js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/main.js b/js/main.js index fccaf452c3..ebcf3f467c 100644 --- a/js/main.js +++ b/js/main.js @@ -111,7 +111,7 @@ var MM = (function () { */ var updateDom = function (module, speed) { if (module.hidden) { - return new Promise(); + return new Promise(function (resolve) {}); } return new Promise(function (resolve) {