Skip to content

Commit

Permalink
loadMeasurements: fix bug for warning notifications
Browse files Browse the repository at this point in the history
Fix bug where the warning notification for measurements JSON was being
fired even when the dataset did not request the measurements panel.

Based on feedback from @jameshadfield
<#1881 (comment)>
  • Loading branch information
joverlee521 committed Nov 5, 2024
1 parent cab837e commit 0069e09
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/actions/measurements.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,13 @@ const parseMeasurementsJSON = (json) => {

export const loadMeasurements = (measurementsData, dispatch) => {
let measurementState = getDefaultMeasurementsState();
/* Just return default state there are no measurements data to load */
if (!measurementsData) {
return measurementState
}

let warningMessage = "";
if (measurementsData === undefined) {
// eslint-disable-next-line no-console
console.debug("No measurements JSON fetched");
} else if (measurementsData instanceof Error) {
if (measurementsData instanceof Error) {
console.error(measurementsData);
warningMessage = "Failed to fetch measurements collections";
} else {
Expand Down

0 comments on commit 0069e09

Please sign in to comment.