From 3c9fe2a6d988f293dce3eb837e8e4cfa9a6a9162 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Sun, 10 Feb 2019 13:40:23 +0000 Subject: [PATCH] Bugfix: Default to the 1st reading type if we can't find PM25 --- Changelog.md | 3 +++ client_src/js/DeviceReadingDisplay.mjs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Changelog.md b/Changelog.md index 817d756..b8cefa0 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,8 @@ # Changelog +## v0.3.2 - 10th February 2019 + - Bugfix: Default to something sensible when opening the device graph in certain cases + ## v0.3.1 - 7th February 2019 - Hidden measurement types in the device graph if a device hasn't reported any readings of that type diff --git a/client_src/js/DeviceReadingDisplay.mjs b/client_src/js/DeviceReadingDisplay.mjs index f281128..f0bbc49 100644 --- a/client_src/js/DeviceReadingDisplay.mjs +++ b/client_src/js/DeviceReadingDisplay.mjs @@ -68,6 +68,9 @@ class DeviceReadingDisplay { await this.fetch_reading_types(); this.reading_type = this.reading_types.find((type) => type.id == default_reading_type); + // Default to the 1st reading type if we can't find the default + if(typeof this.reading_type == "undefined") + this.reading_type = this.reading_types[0].id; // Create the reading type buttons let reading_type_list = this.display.querySelector(".reading-types");