[Fleet] Only call setSelectionType when not loading (#133769)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Mark Hopkin 2022-06-07 16:35:48 +01:00 committed by GitHub
parent 7e3cdb92b4
commit 57c17649f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,6 +70,8 @@ export const Instructions = (props: InstructionProps) => {
return settings?.fleet_server_hosts || [];
}, [settings]);
if (isLoadingAgents || isLoadingAgentPolicies) return <Loading size="l" />;
const hasNoFleetServerHost = fleetStatus.isReady && fleetServerHosts.length === 0;
const showAgentEnrollment =
@ -89,8 +91,6 @@ export const Instructions = (props: InstructionProps) => {
setSelectionType('tabs');
}
if (isLoadingAgents || isLoadingAgentPolicies) return <Loading size="l" />;
if (hasNoFleetServerHost) {
return null;
}