From 23416883c734cc3862b855b646f1684e5c42388e Mon Sep 17 00:00:00 2001 From: Raul Kele Date: Thu, 26 Jan 2023 15:36:53 +0200 Subject: [PATCH] fix: infinite loading bug on cve fix Signed-off-by: Raul Kele --- src/components/VulnerabilitiesDetails.jsx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/components/VulnerabilitiesDetails.jsx b/src/components/VulnerabilitiesDetails.jsx index c379f4d7..6b8c11ed 100644 --- a/src/components/VulnerabilitiesDetails.jsx +++ b/src/components/VulnerabilitiesDetails.jsx @@ -199,16 +199,16 @@ function VulnerabilitiesDetails(props) { ) .then((response) => { if (response.data && response.data.data) { - if (!isEmpty(response.data.data.CVEListForImage?.CVEList)) { - let cveInfo = response.data.data.CVEListForImage.CVEList; - let cveListData = mapCVEInfo(cveInfo); - const newCVEList = [...cveData, ...cveListData]; - setCveData(newCVEList); - setIsEndOfList( - response.data.data.CVEListForImage.Page?.ItemCount < EXPLORE_PAGE_SIZE || - newCVEList.length >= response.data.data.CVEListForImage?.Page?.TotalCount - ); - } + let cveInfo = response.data.data.CVEListForImage?.CVEList; + let cveListData = mapCVEInfo(cveInfo); + const newCVEList = [...cveData, ...cveListData]; + setCveData(newCVEList); + setIsEndOfList( + response.data.data.CVEListForImage.Page?.ItemCount < EXPLORE_PAGE_SIZE || + newCVEList.length >= response.data.data.CVEListForImage?.Page?.TotalCount + ); + } else if (response.data.errors) { + setIsEndOfList(true); } setIsLoading(false); }) @@ -269,7 +269,7 @@ function VulnerabilitiesDetails(props) { if (!isLoading && !isEndOfList) { return
; } - return ''; + return; }; return (