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 (