From 8a421f678660da36b6390ec284ffc7cd18bff044 Mon Sep 17 00:00:00 2001 From: Jover Lee Date: Mon, 29 Jul 2024 16:08:12 -0700 Subject: [PATCH 1/5] docs: fix link to dev docs --- docs/introduction/install.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/introduction/install.rst b/docs/introduction/install.rst index d99c2a86b..39355b980 100644 --- a/docs/introduction/install.rst +++ b/docs/introduction/install.rst @@ -36,7 +36,7 @@ If you look at the :doc:`release notes <../releases/changelog>` you can see the Install Auspice as a developer ============================== -See `DEV_DOCS.md __`. +See `DEV_DOCS.md `__. Testing if it worked ==================== From eaef12f39f8971bcdb40e0d0aa81a601fe9c033d Mon Sep 17 00:00:00 2001 From: Jover Lee Date: Mon, 29 Jul 2024 16:32:16 -0700 Subject: [PATCH 2/5] measurements: Allow `thresholds` to be undefined Prevent the app from crashing if the collection's threshold is undefined. Resolves --- src/components/measurements/measurementsD3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/measurements/measurementsD3.js b/src/components/measurements/measurementsD3.js index a70025bac..ccd158e08 100644 --- a/src/components/measurements/measurementsD3.js +++ b/src/components/measurements/measurementsD3.js @@ -197,7 +197,7 @@ export const drawMeasurementsSVG = (ref, xAxisRef, svgData) => { drawStickyXAxis(xAxisRef, containerHeight, svgHeight, xScale, x_axis_label); // Add threshold(s) if provided - if (thresholds !== null) { + if (thresholds !== null && thresholds !== undefined) { for (const threshold of thresholds) { const thresholdXValue = xScale(threshold); svg.append("line") From 4d69f60c4f2d7e48b65626d17bf9c6ce415af5b6 Mon Sep 17 00:00:00 2001 From: Jover Lee Date: Mon, 29 Jul 2024 16:51:03 -0700 Subject: [PATCH 3/5] measurements: Fix `measurements_display` typo Honor the collection's `display_defaults.measurements_display` that is provided in the measurements JSON. Resolves --- src/actions/measurements.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/actions/measurements.js b/src/actions/measurements.js index ccdf1a9c7..bbdff7762 100644 --- a/src/actions/measurements.js +++ b/src/actions/measurements.js @@ -73,7 +73,7 @@ const getCollectionDisplayControls = (controls, collection) => { if (collection["display_defaults"]) { const { group_by, - measurement_display, + measurements_display, show_overall_mean, show_threshold } = collection["display_defaults"]; @@ -81,8 +81,8 @@ const getCollectionDisplayControls = (controls, collection) => { if (group_by) { newControls.measurementsGroupBy = group_by; } - if (measurement_display) { - newControls.measurementsDisplay = measurement_display; + if (measurements_display) { + newControls.measurementsDisplay = measurements_display; } if (typeof show_overall_mean === "boolean") { newControls.measurementsShowOverallMean = show_overall_mean; From 05d142cc02a173ba144e270fe63ebc68eb3ecbf8 Mon Sep 17 00:00:00 2001 From: Jover Lee Date: Mon, 29 Jul 2024 17:03:11 -0700 Subject: [PATCH 4/5] Update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f4509b42..de34d6f3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +* Fix bug where app crashed if measurements JSON did not define thresholds ([#1802](https://github.com/nextstrain/auspice/pull/1802)) +* Fix bug where measurements display did not honor the default `measurements_display` ([#1802](https://github.com/nextstrain/auspice/pull/1802)) + ## version 2.56.0 - 2024/07/01 From 172c55622a12e2838c0f106f2280f17be399791a Mon Sep 17 00:00:00 2001 From: Jover Lee Date: Tue, 30 Jul 2024 12:50:16 -0700 Subject: [PATCH 5/5] measurements: Additional guards against invalid thresholds Prompted by @genehack's review comment --- src/components/measurements/measurementsD3.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/measurements/measurementsD3.js b/src/components/measurements/measurementsD3.js index ccd158e08..a387e6fad 100644 --- a/src/components/measurements/measurementsD3.js +++ b/src/components/measurements/measurementsD3.js @@ -197,8 +197,9 @@ export const drawMeasurementsSVG = (ref, xAxisRef, svgData) => { drawStickyXAxis(xAxisRef, containerHeight, svgHeight, xScale, x_axis_label); // Add threshold(s) if provided - if (thresholds !== null && thresholds !== undefined) { + if (Array.isArray(thresholds)) { for (const threshold of thresholds) { + if (typeof threshold !== "number") continue; const thresholdXValue = xScale(threshold); svg.append("line") .attr("class", classes.threshold)