Skip to content

Commit

Permalink
Fix two more issues when file information is missing (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito authored Feb 14, 2025
1 parent ba77bd2 commit 58a0282
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "data-portal-ui",
"version": "1.4.3",
"version": "1.4.4",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-svg-core": "~6.6.0",
Expand Down Expand Up @@ -73,4 +73,4 @@
"msw": {
"workerDirectory": "public"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@ const SingleDatasetViewAccordion = (props: SingleDatasetViewAccordionProps) => {
const file_category =
key.charAt(0).toUpperCase() + key.slice(1, -1).replaceAll("_", " ");
const fileInfoMap = new Map();
props.files.file_information.forEach((fileInfo) =>
fileInfoMap.set(fileInfo.accession, fileInfo)
);
const fileInformation = props.files.file_information;
if (fileInformation) {
fileInformation.forEach((fileInfo) =>
fileInfoMap.set(fileInfo.accession, fileInfo)
);
}
return files.map((file: any) => {
const fileInfo = fileInfoMap.get(file.accession);
return { ...file, ...fileInfo, file_category };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const FilesTable = (props: FilesTableProps) => {
transposeTableForHTML(filesTable.map((x) => x.data))
);

var totalSize = allFiles.reduce((a, x) => a + x.size, 0);
var totalSize = allFiles.reduce((a, x) => a + x?.size || 0, 0);

const filesTableDef: SDSVTableDefinition = {
table: filesTable,
Expand Down

0 comments on commit 58a0282

Please sign in to comment.