After create/delete, refresh database list

pull/10616/head
Luke Morris 2017-11-09 17:17:37 -08:00
parent 50a0ae90d5
commit 0e4113de23
2 changed files with 12 additions and 6 deletions

View File

@ -6,7 +6,7 @@ import VisView from 'src/data_explorer/components/VisView'
import {GRAPH, TABLE} from 'shared/constants'
import _ from 'lodash'
const META_QUERY_REGEX = /^show/i
const META_QUERY_REGEX = /^(show|create|drop)/i
class Visualization extends Component {
constructor(props) {

View File

@ -45,12 +45,18 @@ const DatabaseList = React.createClass({
this.getDbRp()
},
componentDidUpdate(prevProps) {
if (_.isEqual(prevProps.querySource, this.props.querySource)) {
return
}
componentDidUpdate({querySource: prevSource, query: prevQuery}) {
const {querySource: nextSource, query: nextQuery} = this.props
const differentSource = !_.isEqual(prevSource, nextSource)
this.getDbRp()
const newMetaQuery =
prevQuery.rawText !== nextQuery.rawText &&
nextQuery.rawText &&
nextQuery.rawText.match(/^(create|drop)/)
if (differentSource || newMetaQuery) {
setTimeout(this.getDbRp, 100)
}
},
getDbRp() {