diff --git a/awx/ui_next/src/screens/Inventory/InventoryHostFacts/InventoryHostFacts.jsx b/awx/ui_next/src/screens/Inventory/InventoryHostFacts/InventoryHostFacts.jsx
index e0940a4531..2f24b4cb38 100644
--- a/awx/ui_next/src/screens/Inventory/InventoryHostFacts/InventoryHostFacts.jsx
+++ b/awx/ui_next/src/screens/Inventory/InventoryHostFacts/InventoryHostFacts.jsx
@@ -11,32 +11,31 @@ import useRequest from '../../../util/useRequest';
import { HostsAPI } from '../../../api';
function InventoryHostFacts({ i18n, host }) {
- const { result: facts, isLoading, error, request: fetchFacts } = useRequest(
+ const { request, isLoading, error, result } = useRequest(
useCallback(async () => {
- const [{ data: factsObj }] = await Promise.all([
- HostsAPI.readFacts(host.id),
- ]);
- return JSON.stringify(factsObj, null, 4);
+ const { data } = await HostsAPI.readFacts(host.id);
+
+ return JSON.stringify(data, null, 4);
}, [host]),
- '{}'
+ null
);
useEffect(() => {
- fetchFacts();
- }, [fetchFacts]);
-
- if (isLoading) {
- return ;
- }
+ request();
+ }, [request]);
if (error) {
return ;
}
+ if (isLoading || result === null) {
+ return ;
+ }
+
return (
-
+
);