Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up measurements Redux states/actions #1881

Merged
merged 12 commits into from
Nov 6, 2024
Prev Previous commit
Next Next commit
loadMeasurements: fix bug for warning notifications
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
commit 0069e09eb66a8a3654b660d881bcb39dac765cd1
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