From 5b6330d06638a4bc109e13d2b2d92a56d174857b Mon Sep 17 00:00:00 2001 From: Pini Shahmurov Date: Mon, 13 Jan 2025 19:38:05 +0200 Subject: [PATCH] Fix [Alerts] Pagination Error Due to Failed API Response (#3010) --- src/hooks/useAlertsPageData.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/hooks/useAlertsPageData.js b/src/hooks/useAlertsPageData.js index 27b4d8282..0ea14ccc2 100644 --- a/src/hooks/useAlertsPageData.js +++ b/src/hooks/useAlertsPageData.js @@ -64,12 +64,10 @@ export const useAlertsPageData = (filters, isAlertsPage) => { ) .unwrap() .then(response => { - if (response?.activations?.length > 0) { - setAlerts(response.activations) - } else { - setAlerts([]) + if (response?.activations) { + setAlerts(response.activations.length > 0 ? response.activations : []) + paginationConfigAlertsRef.current.paginationResponse = response.pagination } - paginationConfigAlertsRef.current.paginationResponse = response.pagination }) }, [dispatch, isAlertsPage, params.id, params.projectName]