From 4150c56ad50ba84fbf9674e743a3591f33a2836e Mon Sep 17 00:00:00 2001 From: Jover Lee Date: Tue, 5 Nov 2024 13:12:31 -0800 Subject: [PATCH] Load measurements JSON with `createStateFromQueryOrJSONs` Updating to support upcoming changes in Auspice from --- auspice_client_customisation/handleDroppedFiles.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/auspice_client_customisation/handleDroppedFiles.js b/auspice_client_customisation/handleDroppedFiles.js index 9825a76..4bbd03b 100644 --- a/auspice_client_customisation/handleDroppedFiles.js +++ b/auspice_client_customisation/handleDroppedFiles.js @@ -1,7 +1,6 @@ import { createStateFromQueryOrJSONs } from "@auspice/actions/recomputeReduxState"; import { errorNotification, warningNotification } from "@auspice/actions/notifications"; import { Dataset, addEndOfNarrativeBlock, getDatasetNamesFromUrl } from "@auspice/actions/loadData"; -import { parseMeasurementsJSON } from "@auspice/actions/measurements"; import { parseMarkdownNarrativeFile } from "@auspice/util/parseNarrative"; import { parseMarkdown } from "@auspice/util/parseMarkdown"; import { isAcceptedFileType as isAuspiceAcceptedFileType } from "@auspice/actions/filesDropped/constants"; @@ -123,15 +122,7 @@ async function collectDatasets(dispatch, files) { filesSeen.add(nameLower); const mainNameLower = nameLower.replace(`_${sidecarSuffix}.json`, '.json'); if (datasets[mainNameLower]) { - // Parse measurements sidecars separately here. - // See https://github.com/nextstrain/auspice/pull/1663 - if (sidecarPropName === 'measurements') { - datasets[mainNameLower][sidecarPropName] = readFile(file) - .then((json) => parseMeasurementsJSON(json)) - .catch((err) => console.error("Failed to read and parse measurements sidecar", err)); - } else { - datasets[mainNameLower][sidecarPropName] = readFile(file); - } + datasets[mainNameLower][sidecarPropName] = readFile(file); logs.push(`Read ${file.name} as a sidecar file of ${datasets[mainNameLower].name}`); } else { dispatch(errorNotification({ @@ -204,6 +195,7 @@ async function loadDatasets(dispatch, datasets, narrative) { pathnameShouldBe: "", ...createStateFromQueryOrJSONs({ json: dataset1.main, + measurementsData: dataset1.measurements ? (await dataset1.measurements) : undefined, secondTreeDataset: dataset2 ? dataset2.main : null, query: {}, narrativeBlocks: narrative,