fix: infinite loading bug on cve fix

Signed-off-by: Raul Kele <raulkeleblk@gmail.com>
This commit is contained in:
Raul Kele 2023-01-26 15:36:53 +02:00
parent a4b25adb51
commit 23416883c7

View File

@ -199,16 +199,16 @@ function VulnerabilitiesDetails(props) {
) )
.then((response) => { .then((response) => {
if (response.data && response.data.data) { if (response.data && response.data.data) {
if (!isEmpty(response.data.data.CVEListForImage?.CVEList)) { let cveInfo = response.data.data.CVEListForImage?.CVEList;
let cveInfo = response.data.data.CVEListForImage.CVEList; let cveListData = mapCVEInfo(cveInfo);
let cveListData = mapCVEInfo(cveInfo); const newCVEList = [...cveData, ...cveListData];
const newCVEList = [...cveData, ...cveListData]; setCveData(newCVEList);
setCveData(newCVEList); setIsEndOfList(
setIsEndOfList( response.data.data.CVEListForImage.Page?.ItemCount < EXPLORE_PAGE_SIZE ||
response.data.data.CVEListForImage.Page?.ItemCount < EXPLORE_PAGE_SIZE || newCVEList.length >= response.data.data.CVEListForImage?.Page?.TotalCount
newCVEList.length >= response.data.data.CVEListForImage?.Page?.TotalCount );
); } else if (response.data.errors) {
} setIsEndOfList(true);
} }
setIsLoading(false); setIsLoading(false);
}) })
@ -269,7 +269,7 @@ function VulnerabilitiesDetails(props) {
if (!isLoading && !isEndOfList) { if (!isLoading && !isEndOfList) {
return <div ref={listBottom} />; return <div ref={listBottom} />;
} }
return ''; return;
}; };
return ( return (