Skip to content

Commit

Permalink
download: Dispatch error notification if dataset names are empty
Browse files Browse the repository at this point in the history
An extra guard against empty dataset names during Auspice JSON downloads
Related to <#1803>
  • Loading branch information
joverlee521 committed Aug 6, 2024
1 parent b7c165b commit dbfce23
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/download/helperFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit dbfce23

Please sign in to comment.