From 9eb8dbfaa70f82774e8bddf5393bce62e2b46a46 Mon Sep 17 00:00:00 2001 From: Victor Rocheleau Date: Thu, 10 Aug 2023 16:25:51 +0000 Subject: [PATCH] fix data-type summaries --- .../datasets/datatype/DataTypeSummaryModal.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/datasets/datatype/DataTypeSummaryModal.js b/src/components/datasets/datatype/DataTypeSummaryModal.js index 6a6c7fa31..cba79bd29 100644 --- a/src/components/datasets/datatype/DataTypeSummaryModal.js +++ b/src/components/datasets/datatype/DataTypeSummaryModal.js @@ -8,20 +8,23 @@ import VariantSummary from "./VariantSummary"; import { useSelector } from "react-redux"; const DataTypeSummaryModal = ({dataType, summary, onCancel, visible}) => { - summary = summary || {}; - dataType = dataType || {}; + if (!dataType) { + return <>; + } const isFetchingSummaries = useSelector((state) => state.datasetDataTypes.isFetching); let Summary = GenericSummary; + let summaryData = summary; switch (dataType.id) { case "variant": - // TODO: variant summary Summary = VariantSummary; break; case "phenopacket": Summary = PhenopacketSummary; break; + default: + summaryData = summary ?? dataType; } return <> @@ -32,9 +35,9 @@ const DataTypeSummaryModal = ({dataType, summary, onCancel, visible}) => { {dataType.id} } > - {(!summary || isFetchingSummaries) + {(!summaryData || isFetchingSummaries) ? - : } + : } ; };