Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit 58a0282

Browse files
authored
Fix two more issues when file information is missing (#254)
1 parent ba77bd2 commit 58a0282

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-portal-ui",
3-
"version": "1.4.3",
3+
"version": "1.4.4",
44
"private": true,
55
"dependencies": {
66
"@fortawesome/fontawesome-svg-core": "~6.6.0",
@@ -73,4 +73,4 @@
7373
"msw": {
7474
"workerDirectory": "public"
7575
}
76-
}
76+
}

src/components/browse/singleDatasetView/singleDatasetViewAccordion/singleDatasetViewAccordion.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,12 @@ const SingleDatasetViewAccordion = (props: SingleDatasetViewAccordionProps) => {
3636
const file_category =
3737
key.charAt(0).toUpperCase() + key.slice(1, -1).replaceAll("_", " ");
3838
const fileInfoMap = new Map();
39-
props.files.file_information.forEach((fileInfo) =>
40-
fileInfoMap.set(fileInfo.accession, fileInfo)
41-
);
39+
const fileInformation = props.files.file_information;
40+
if (fileInformation) {
41+
fileInformation.forEach((fileInfo) =>
42+
fileInfoMap.set(fileInfo.accession, fileInfo)
43+
);
44+
}
4245
return files.map((file: any) => {
4346
const fileInfo = fileInfoMap.get(file.accession);
4447
return { ...file, ...fileInfo, file_category };

src/components/browse/singleDatasetView/singleDatasetViewAccordion/tables/filesTable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const FilesTable = (props: FilesTableProps) => {
103103
transposeTableForHTML(filesTable.map((x) => x.data))
104104
);
105105

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

108108
const filesTableDef: SDSVTableDefinition = {
109109
table: filesTable,

0 commit comments

Comments
 (0)