From 86949174409103cdceb77c7e40d9d247974e161b Mon Sep 17 00:00:00 2001 From: Michael Geers Date: Sat, 25 Jan 2025 12:52:31 +0100 Subject: [PATCH] Config UI: improve device updates (#18405) --- assets/js/views/Config.vue | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/assets/js/views/Config.vue b/assets/js/views/Config.vue index 916ef768f..0067c6505 100644 --- a/assets/js/views/Config.vue +++ b/assets/js/views/Config.vue @@ -619,16 +619,17 @@ export default { async updateValues() { clearTimeout(this.deviceValueTimeout); if (!this.offline) { - const promises = [ - ...this.meters.map((meter) => this.updateDeviceValue("meter", meter.name)), - ...this.vehicles.map((vehicle) => - this.updateDeviceValue("vehicle", vehicle.name) - ), - ]; - - await Promise.all(promises); + for (const meter of this.meters) { + await this.updateDeviceValue("meter", meter.name); + } + for (const vehicle of this.vehicles) { + await this.updateDeviceValue("vehicle", vehicle.name); + } } - this.deviceValueTimeout = setTimeout(this.updateValues, 10000); + // ensure that component is still mounted + if (!this.$el) return; + const interval = (store.state?.interval || 30) * 1000; + this.deviceValueTimeout = setTimeout(this.updateValues, interval); }, deviceTags(type, id) { return this.deviceValues[type]?.[id] || [];