Prevent infinite looping of API call

pull/10616/head
Christopher Henn 2018-07-10 14:00:31 -07:00 committed by Chris Henn
parent b0d22dcb33
commit 69b5eb9a5c
1 changed files with 5 additions and 2 deletions

View File

@ -52,6 +52,7 @@ class DatabaseList extends Component<DatabaseListProps, DatabaseListState> {
public componentDidUpdate({
querySource: prevSource,
query: prevQuery,
}: {
querySource?: Source
query: QueryConfig
@ -60,10 +61,12 @@ class DatabaseList extends Component<DatabaseListProps, DatabaseListState> {
const differentSource = !_.isEqual(prevSource, nextSource)
const newMetaQuery =
nextQuery.rawText && nextQuery.rawText.match(/^(create|drop)/i)
nextQuery.rawText &&
nextQuery.rawText.match(/^(create|drop)/i) &&
nextQuery.rawText !== prevQuery.rawText
if (differentSource || newMetaQuery) {
setTimeout(this.getDbRp, 100)
this.getDbRp()
}
}