diff --git a/changes/issue-2269-query-results b/changes/issue-2269-query-results new file mode 100644 index 0000000000..8809bcba57 --- /dev/null +++ b/changes/issue-2269-query-results @@ -0,0 +1 @@ +- Fixed empty table showing while retrieving results \ No newline at end of file diff --git a/frontend/pages/queries/QueryPage/components/QueryResults/QueryResults.tsx b/frontend/pages/queries/QueryPage/components/QueryResults/QueryResults.tsx index cff8912b26..8aa320457c 100644 --- a/frontend/pages/queries/QueryPage/components/QueryResults/QueryResults.tsx +++ b/frontend/pages/queries/QueryPage/components/QueryResults/QueryResults.tsx @@ -186,6 +186,28 @@ const QueryResults = ({ }; const renderTable = () => { + const emptyResults = !queryResults || !queryResults.length; + const hasNoResultsYet = !isQueryFinished && emptyResults; + const finishedWithNoResults = + isQueryFinished && (!hostsCount.successful || emptyResults); + + if (hasNoResultsYet) { + return null; + } + + if (finishedWithNoResults) { + return ( +
+ Your live query returned no results. + + Expecting to see results? Check to see if the hosts you targeted + reported “Online” or check out the “Errors” + table. + +
+ ); + } + return (