Skip to content

Commit

Permalink
Making sure version summary is not loaded by default
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Oct 25, 2021
1 parent 330f7ae commit 4dce271
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/sources/SourceHome.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ class SourceHome extends React.Component {
.overrideURL(this.getVersionedObjectURLFromPath() + 'versions/')
.get(null, null, {verbose: true})
.then(response => {
this.setState({versions: response.data, isLoadingVersions: false}, this.fetchVersionsSummary)
this.setState({versions: response.data, isLoadingVersions: false}, () => {
if(this.isVersionTabSelected())
this.fetchVersionsSummary()
})
})
})
}
Expand Down Expand Up @@ -140,6 +143,8 @@ class SourceHome extends React.Component {
this.setState({tab: value, selected: null, splitView: false}, () => {
if(isEmpty(this.state.versions))
this.getVersions()
if(this.isVersionTabSelected())
this.fetchVersionsSummary()
})
}

Expand Down Expand Up @@ -229,6 +234,10 @@ class SourceHome extends React.Component {

toggleSplitView = () => this.setState({splitView: !this.state.splitView})

currentTabConfig = () => get(this.state.selectedConfig, `config.tabs.${this.state.tab}`)

isVersionTabSelected = () => get(this.currentTabConfig(), 'type') === 'versions';

render() {
const {
source, versions, isLoading, tab, selectedConfig, customConfigs,
Expand Down

0 comments on commit 4dce271

Please sign in to comment.