Skip to content

Commit

Permalink
[vision] Fall back to configured dataset if list cannot be loaded (#1996
Browse files Browse the repository at this point in the history
)
  • Loading branch information
runeb committed Sep 3, 2020
1 parent 46898aa commit 2c842a3
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions packages/@sanity/vision/src/containers/VisionContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,20 @@ import LoadingContainer from './LoadingContainer'
class VisionContainer extends LoadingContainer {
getSubscriptions() {
return {
datasets: {uri: '/datasets'}
datasets: { uri: '/datasets' }
}
}

render() {
const datasets = this.state.datasets || []
if (this.state.error) {
return (
<ErrorDialog
heading="An error occured while loading project data"
error={this.state.error}
/>
)
}

if (!this.hasAllData()) {
const defaultDataset = this.context.client.config().dataset
datasets[0] = { name: defaultDataset }
} else if (!this.hasAllData()) {
return <DelayedSpinner />
}

return <VisionGui {...this.state} {...this.props} />
return <VisionGui {...this.state} {...this.props} datasets={datasets} />
}
}

Expand Down

1 comment on commit 2c842a3

@vercel
Copy link

@vercel vercel bot commented on 2c842a3 Sep 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.