From a43b5143d428f0b7758e8bd29569c44106607d13 Mon Sep 17 00:00:00 2001 From: jbiset Date: Fri, 15 Dec 2023 16:48:49 -0300 Subject: [PATCH] Fix warning when there is no data in the vulnerability tab --- .../common/hooks/useCheckIndexFields.tsx | 2 +- .../vulnerabilities/dashboards/overview/dashboard.tsx | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/plugins/main/public/components/overview/vulnerabilities/common/hooks/useCheckIndexFields.tsx b/plugins/main/public/components/overview/vulnerabilities/common/hooks/useCheckIndexFields.tsx index 75112cbc85..8f333c1a34 100644 --- a/plugins/main/public/components/overview/vulnerabilities/common/hooks/useCheckIndexFields.tsx +++ b/plugins/main/public/components/overview/vulnerabilities/common/hooks/useCheckIndexFields.tsx @@ -69,7 +69,7 @@ const useCheckIndexFields = ( checkIndexFields(); } - }, [indexPatternId]); + }, [indexPatternId, query]); return { isError, diff --git a/plugins/main/public/components/overview/vulnerabilities/dashboards/overview/dashboard.tsx b/plugins/main/public/components/overview/vulnerabilities/dashboards/overview/dashboard.tsx index 911548c996..5c24a31003 100644 --- a/plugins/main/public/components/overview/vulnerabilities/dashboards/overview/dashboard.tsx +++ b/plugins/main/public/components/overview/vulnerabilities/dashboards/overview/dashboard.tsx @@ -50,6 +50,7 @@ const DashboardVulsComponent: React.FC = () => { <> <> +

{resultIndexData?.hits?.total}

{isLoading || isLoadingSearchbar ? : null} {!isLoading && !isLoadingSearchbar ? ( { ) : null} {!isLoadingSearchbar && !isLoading && - (isError || resultIndexData?.hits?.total === 0) ? ( + (isError || + !resultIndexData?.hits?.total || + resultIndexData?.hits?.total === 0) ? ( ) : null} - {!isLoadingSearchbar && !isLoading && isSuccess ? ( + {!isLoadingSearchbar && + !isLoading && + isSuccess && + resultIndexData?.hits?.total && + resultIndexData?.hits?.total > 0 ? ( <>