diff --git a/web/src/components/datasets/DatasetDetailPage.tsx b/web/src/components/datasets/DatasetDetailPage.tsx index 1172340931..bb01ed675e 100644 --- a/web/src/components/datasets/DatasetDetailPage.tsx +++ b/web/src/components/datasets/DatasetDetailPage.tsx @@ -56,6 +56,7 @@ import StorageIcon from '@mui/icons-material/Storage' interface StateProps { lineageDataset: LineageDataset dataset: Dataset + isDatasetLoading: boolean initVersions: DatasetVersion[] initVersionsLoading: boolean datasets: IState['datasets'] @@ -86,6 +87,7 @@ const DatasetDetailPage: FunctionComponent = (props) => { const { datasets, dataset, + isDatasetLoading, display, fetchDataset, resetDataset, @@ -118,7 +120,7 @@ const DatasetDetailPage: FunctionComponent = (props) => { useEffect(() => { fetchInitialDatasetVersions(lineageDataset.namespace, lineageDataset.name) fetchDataset(lineageDataset.namespace, lineageDataset.name) - }, [lineageDataset.name, showTags]) + }, [lineageDataset.name]) // if the dataset is deleted then redirect to datasets end point useEffect(() => { @@ -131,7 +133,7 @@ const DatasetDetailPage: FunctionComponent = (props) => { setTabIndex(newValue) } - if (initVersionsLoading && initVersions.length === 0) { + if (!dataset || isDatasetLoading || (initVersionsLoading && initVersions.length === 0)) { return ( @@ -144,10 +146,9 @@ const DatasetDetailPage: FunctionComponent = (props) => { } const firstVersion = initVersions[0] - const { name, tags, description } = firstVersion - const facetsStatus = datasetFacetsStatus(firstVersion.facets) - - const assertions = datasetFacetsQualityAssertions(firstVersion.facets) + const { name, tags, description } = dataset + const facetsStatus = datasetFacetsStatus(dataset.facets) + const assertions = datasetFacetsQualityAssertions(dataset.facets) return ( @@ -229,21 +230,21 @@ const DatasetDetailPage: FunctionComponent = (props) => { } label={'Updated at'.toUpperCase()} - value={formatUpdatedAt(firstVersion.createdAt)} + value={formatUpdatedAt(dataset.createdAt)} /> } label={'Dataset Type'.toUpperCase()} - value={{firstVersion.type}} + value={{dataset.type}} /> } label={'Fields'.toUpperCase()} - value={`${firstVersion.fields.length} columns`} + value={`${dataset.fields.length} columns`} /> @@ -338,8 +339,8 @@ const DatasetDetailPage: FunctionComponent = (props) => { {tabIndex === 0 && ( = (props) => { const mapStateToProps = (state: IState) => ({ datasets: state.datasets, dataset: state.dataset.result, + isDatasetLoading: state.dataset.isLoading, display: state.display, initVersions: state.datasetVersions.initDsVersion.versions, initVersionsLoading: state.datasetVersions.isInitDsVerLoading,