Fleet UI: Fix manage host page for invalid query strings spinner (#9198)
This commit is contained in:
@@ -0,0 +1 @@
|
||||
- Invalid query string will not result in neverending spinner
|
||||
@@ -351,7 +351,7 @@ const ManageHostsPage = ({
|
||||
}
|
||||
);
|
||||
|
||||
useQuery<IStoredPolicyResponse, Error>(
|
||||
const { isLoading: isLoadingPolicy } = useQuery<IStoredPolicyResponse, Error>(
|
||||
["policy"],
|
||||
() => globalPoliciesAPI.load(policyId),
|
||||
{
|
||||
@@ -359,6 +359,9 @@ const ManageHostsPage = ({
|
||||
onSuccess: ({ policy: policyAPIResponse }) => {
|
||||
setPolicy(policyAPIResponse);
|
||||
},
|
||||
onError: () => {
|
||||
setHasHostErrors(true);
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1647,7 +1650,14 @@ const ManageHostsPage = ({
|
||||
};
|
||||
|
||||
const renderTable = () => {
|
||||
if (!config || !currentUser || !hosts || !teamSync) {
|
||||
if (
|
||||
!config ||
|
||||
!currentUser ||
|
||||
isHostCountLoading ||
|
||||
isHostsLoading ||
|
||||
isLoadingPolicy ||
|
||||
!teamSync
|
||||
) {
|
||||
return <Spinner />;
|
||||
}
|
||||
|
||||
@@ -1755,7 +1765,7 @@ const ManageHostsPage = ({
|
||||
return (
|
||||
<TableContainer
|
||||
columns={tableColumns}
|
||||
data={hosts}
|
||||
data={hosts || []}
|
||||
isLoading={isHostsLoading || isHostCountLoading}
|
||||
manualSortBy
|
||||
defaultSortHeader={(sortBy[0] && sortBy[0].key) || DEFAULT_SORT_HEADER}
|
||||
|
||||
Reference in New Issue
Block a user