From 69b5eb9a5c5cfedf971cabad5b5717ec2569aa2c Mon Sep 17 00:00:00 2001 From: Christopher Henn Date: Tue, 10 Jul 2018 14:00:31 -0700 Subject: [PATCH] Prevent infinite looping of API call --- ui/src/shared/components/DatabaseList.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ui/src/shared/components/DatabaseList.tsx b/ui/src/shared/components/DatabaseList.tsx index 05f260e16d..053ca971ee 100644 --- a/ui/src/shared/components/DatabaseList.tsx +++ b/ui/src/shared/components/DatabaseList.tsx @@ -52,6 +52,7 @@ class DatabaseList extends Component { public componentDidUpdate({ querySource: prevSource, + query: prevQuery, }: { querySource?: Source query: QueryConfig @@ -60,10 +61,12 @@ class DatabaseList extends Component { 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() } }