@@ -56,6 +56,7 @@ import StorageIcon from '@mui/icons-material/Storage'
5656interface StateProps {
5757 lineageDataset : LineageDataset
5858 dataset : Dataset
59+ isDatasetLoading : boolean
5960 initVersions : DatasetVersion [ ]
6061 initVersionsLoading : boolean
6162 datasets : IState [ 'datasets' ]
@@ -86,6 +87,7 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
8687 const {
8788 datasets,
8889 dataset,
90+ isDatasetLoading,
8991 display,
9092 fetchDataset,
9193 resetDataset,
@@ -118,7 +120,7 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
118120 useEffect ( ( ) => {
119121 fetchInitialDatasetVersions ( lineageDataset . namespace , lineageDataset . name )
120122 fetchDataset ( lineageDataset . namespace , lineageDataset . name )
121- } , [ lineageDataset . name , showTags ] )
123+ } , [ lineageDataset . name ] )
122124
123125 // if the dataset is deleted then redirect to datasets end point
124126 useEffect ( ( ) => {
@@ -131,7 +133,7 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
131133 setTabIndex ( newValue )
132134 }
133135
134- if ( initVersionsLoading && initVersions . length === 0 ) {
136+ if ( ! dataset || isDatasetLoading || ( initVersionsLoading && initVersions . length === 0 ) ) {
135137 return (
136138 < Box display = { 'flex' } justifyContent = { 'center' } mt = { 2 } >
137139 < CircularProgress color = 'primary' />
@@ -144,10 +146,9 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
144146 }
145147
146148 const firstVersion = initVersions [ 0 ]
147- const { name, tags, description } = firstVersion
148- const facetsStatus = datasetFacetsStatus ( firstVersion . facets )
149-
150- const assertions = datasetFacetsQualityAssertions ( firstVersion . facets )
149+ const { name, tags, description } = dataset
150+ const facetsStatus = datasetFacetsStatus ( dataset . facets )
151+ const assertions = datasetFacetsQualityAssertions ( dataset . facets )
151152
152153 return (
153154 < Box px = { 2 } >
@@ -229,21 +230,21 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
229230 < MqInfo
230231 icon = { < CalendarIcon color = { 'disabled' } /> }
231232 label = { 'Updated at' . toUpperCase ( ) }
232- value = { formatUpdatedAt ( firstVersion . createdAt ) }
233+ value = { formatUpdatedAt ( dataset . createdAt ) }
233234 />
234235 </ Grid >
235236 < Grid item xs = { 6 } >
236237 < MqInfo
237238 icon = { < StorageIcon color = { 'disabled' } /> }
238239 label = { 'Dataset Type' . toUpperCase ( ) }
239- value = { < MqText font = { 'mono' } > { firstVersion . type } </ MqText > }
240+ value = { < MqText font = { 'mono' } > { dataset . type } </ MqText > }
240241 />
241242 </ Grid >
242243 < Grid item xs = { 6 } >
243244 < MqInfo
244245 icon = { < ListIcon color = { 'disabled' } /> }
245246 label = { 'Fields' . toUpperCase ( ) }
246- value = { `${ firstVersion . fields . length } columns` }
247+ value = { `${ dataset . fields . length } columns` }
247248 />
248249 </ Grid >
249250 < Grid item xs = { 6 } >
@@ -338,8 +339,8 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
338339 { tabIndex === 0 && (
339340 < DatasetInfo
340341 dataset = { dataset }
341- datasetFields = { firstVersion . fields }
342- facets = { firstVersion . facets }
342+ datasetFields = { dataset . fields }
343+ facets = { dataset . facets }
343344 run = { firstVersion . createdByRun }
344345 showTags = { showTags }
345346 isCurrentVersion
@@ -353,6 +354,7 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
353354const mapStateToProps = ( state : IState ) => ( {
354355 datasets : state . datasets ,
355356 dataset : state . dataset . result ,
357+ isDatasetLoading : state . dataset . isLoading ,
356358 display : state . display ,
357359 initVersions : state . datasetVersions . initDsVersion . versions ,
358360 initVersionsLoading : state . datasetVersions . isInitDsVerLoading ,
0 commit comments