From daa8a5d31af46989376d1efb6a9952d90be89843 Mon Sep 17 00:00:00 2001 From: gillespi314 <73313222+gillespi314@users.noreply.github.com> Date: Mon, 11 Oct 2021 10:11:54 -0500 Subject: [PATCH] Fix title of manage hosts page UI for free version (#2467) --- changes/fix-2458 | 1 + .../hosts/ManageHostsPage/ManageHostsPage.tsx | 20 +++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 changes/fix-2458 diff --git a/changes/fix-2458 b/changes/fix-2458 new file mode 100644 index 0000000000..4a0f58576d --- /dev/null +++ b/changes/fix-2458 @@ -0,0 +1 @@ +* Fix missing default header on manage hosts page for Fleet Free version \ No newline at end of file diff --git a/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx b/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx index 1006e9425e..2d6885a0c7 100644 --- a/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx +++ b/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx @@ -224,14 +224,14 @@ const ManageHostsPage = ({ } ); - const { data: teams } = useQuery( - ["teams"], - () => teamsAPI.loadAll(), - { - enabled: isPremiumTier, - select: (data: ITeamsResponse) => data.teams, - } - ); + const { data: teams, isLoading: isLoadingTeams } = useQuery< + ITeamsResponse, + Error, + ITeam[] + >(["teams"], () => teamsAPI.loadAll(), { + enabled: !!isPremiumTier, + select: (data: ITeamsResponse) => data.teams, + }); useQuery( ["policy"], @@ -757,7 +757,7 @@ const ManageHostsPage = ({ }; const renderTeamsFilterDropdown = () => { - if (!isPremiumTier || !teams) { + if (isPremiumTier && isLoadingTeams) { return null; } @@ -766,7 +766,7 @@ const ManageHostsPage = ({ } const teamOptions = generateTeamFilterDropdownOptions( - teams, + teams || [], currentUser, isOnGlobalTeam as boolean );