From 02a12709b7b8f5aa3c27cd06c994fe05a5790350 Mon Sep 17 00:00:00 2001 From: noahtalerman <47070608+noahtalerman@users.noreply.github.com> Date: Wed, 14 Apr 2021 19:22:12 -0700 Subject: [PATCH] Switch selectedTargets.count with targetsCount (#645) - Fix handling of live query error when the number of hosts targeted is 0. PR #641 attempted to handle the case when a user, running a live query, selects a label that contains 0 hosts. The fix in this earlier PR introduced a bug that prevented the user from running a live query at all! --- frontend/pages/queries/QueryPage/QueryPage.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/pages/queries/QueryPage/QueryPage.jsx b/frontend/pages/queries/QueryPage/QueryPage.jsx index 6e42dce981..50bb527d1a 100644 --- a/frontend/pages/queries/QueryPage/QueryPage.jsx +++ b/frontend/pages/queries/QueryPage/QueryPage.jsx @@ -219,7 +219,7 @@ export class QueryPage extends Component { }; onRunQuery = debounce(() => { - const { queryText } = this.state; + const { queryText, targetsCount } = this.state; const { query } = this.props.query; const sql = queryText || query; const { dispatch, selectedTargets } = this.props; @@ -233,7 +233,7 @@ export class QueryPage extends Component { return false; } - if (!selectedTargets.count) { + if (!targetsCount) { this.setState({ targetsError: "You must select a target with at least one host to run a query",