From 1d891cd343a8ab3143fa3fb7a0ee7665705ad519 Mon Sep 17 00:00:00 2001 From: Luke Heath Date: Wed, 22 Dec 2021 20:56:52 -0600 Subject: [PATCH] Fix incorrect load state when selecting all hosts from the hosts filter (#3426) --- changes/issue-3260-fix-load-state | 1 + .../hosts/ManageHostsPage/ManageHostsPage.tsx | 17 +++++++++-------- .../components/NoHosts/NoHosts.tsx | 1 - 3 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 changes/issue-3260-fix-load-state diff --git a/changes/issue-3260-fix-load-state b/changes/issue-3260-fix-load-state new file mode 100644 index 0000000000..7a59f64641 --- /dev/null +++ b/changes/issue-3260-fix-load-state @@ -0,0 +1 @@ +* Fix incorrect load state when selecting all hosts from the hosts filter. \ No newline at end of file diff --git a/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx b/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx index f663307df8..510154ecef 100644 --- a/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx +++ b/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx @@ -530,9 +530,8 @@ const ManageHostsPage = ({ softwareId, ]); - const handleLabelChange = ({ slug }: ILabel) => { + const handleLabelChange = ({ slug }: ILabel): boolean => { if (!slug) { - console.error("Slug was missing. This should not happen."); return false; } @@ -580,6 +579,8 @@ const ManageHostsPage = ({ queryParams: newQueryParams, }) ); + + return true; }; const handleChangePoliciesFilter = (response: PolicyResponse) => { @@ -1480,13 +1481,12 @@ const ManageHostsPage = ({ return ; } - // Hosts have not been set up for this instance yet. + // There are no hosts for this instance yet if ( - (getStatusSelected() === ALL_HOSTS_LABEL && selectedLabel.count === 0) || - (getStatusSelected() === ALL_HOSTS_LABEL && - filteredHostCount === 0 && - searchQuery === "" && - !isHostsLoading) + getStatusSelected() === ALL_HOSTS_LABEL && + filteredHostCount === 0 && + searchQuery === "" && + !isHostsLoading ) { return (