From dbfce230392927f83a921c29e8447287d4133187 Mon Sep 17 00:00:00 2001 From: Jover Lee Date: Tue, 30 Jul 2024 17:36:33 -0700 Subject: [PATCH] download: Dispatch error notification if dataset names are empty An extra guard against empty dataset names during Auspice JSON downloads Related to --- src/components/download/helperFunctions.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/download/helperFunctions.js b/src/components/download/helperFunctions.js index 969cd8dc9..3abb194b4 100644 --- a/src/components/download/helperFunctions.js +++ b/src/components/download/helperFunctions.js @@ -631,6 +631,10 @@ export const entropyTSV = (dispatch, filePrefix, entropy) => { */ export const auspiceJSON = (dispatch, datasetNames) => { const filenames = []; + if (!datasetNames.some(Boolean)) { + console.error(`Unable to fetch empty dataset names: ${JSON.stringify(datasetNames)}`); + return dispatch(errorNotification({message: "Unable to download Auspice JSON (see console for more info)"})) + } for (const datasetName of datasetNames) { if (!datasetName) continue; // e.g. no 2nd tree const filename = datasetName.replace('/', '_') + '.json';