From f5b741adf035b91bf5612bc819fc0e0e852936a8 Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Wed, 14 Oct 2020 09:36:39 +0200 Subject: [PATCH 1/6] Do not run updateDom() on hidden modules. --- js/main.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/main.js b/js/main.js index 9d241a07e1..96c7fcec59 100644 --- a/js/main.js +++ b/js/main.js @@ -110,6 +110,10 @@ var MM = (function () { * @returns {Promise} Resolved when the dom is fully updated. */ var updateDom = function (module, speed) { + if (module.hidden) { + return; + } + return new Promise(function (resolve) { var newContentPromise = module.getDom(); var newHeader = module.getHeader(); From 5f38cb614b086befd7718088153af30084f0bb53 Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Wed, 14 Oct 2020 09:45:32 +0200 Subject: [PATCH 2/6] Fix prettier issues. --- js/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/main.js b/js/main.js index 96c7fcec59..32a8c23ea0 100644 --- a/js/main.js +++ b/js/main.js @@ -111,9 +111,9 @@ var MM = (function () { */ var updateDom = function (module, speed) { if (module.hidden) { - return; + return; } - + return new Promise(function (resolve) { var newContentPromise = module.getDom(); var newHeader = module.getHeader(); From a5297918fa3561573d09cb5277978b5885c040df Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Wed, 14 Oct 2020 09:48:07 +0200 Subject: [PATCH 3/6] Add changelog entry. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c360e5113e..f3ffaad67d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ _This release is scheduled to be released on 2021-01-01._ - Calendar parsing where RRULE bug returns wrong date, add Windows timezone name support. (#2145, #2151) - 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) ## [2.13.0] - 2020-10-01 From fda3db2c9b586b4c83b73fe21e637bf71b778f24 Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Wed, 14 Oct 2020 10:06:37 +0200 Subject: [PATCH 4/6] Return expected promise. --- js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/main.js b/js/main.js index 32a8c23ea0..fccaf452c3 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; + return new Promise(); } return new Promise(function (resolve) { From 2679fcf7393cfb68d61f2f6efd1b84e417bf646d Mon Sep 17 00:00:00 2001 From: Sam Detweiler Date: Thu, 15 Oct 2020 07:43:32 -0500 Subject: [PATCH 5/6] 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 6/6] 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) {