diff --git a/client/src/Components/v1/GenericFallback/index.jsx b/client/src/Components/v1/GenericFallback/index.jsx
index 137cdd1da..188c09f37 100644
--- a/client/src/Components/v1/GenericFallback/index.jsx
+++ b/client/src/Components/v1/GenericFallback/index.jsx
@@ -40,13 +40,13 @@ const GenericFallback = ({ children }) => {
{
- await resolveIncident(incidentId);
- handleUpdateTrigger();
+ try {
+ await resolveIncident(incidentId);
+ handleUpdateTrigger();
+ } catch (error) {
+ console.error(t("incidentsPage.errorResolvingIncident"), error);
+ }
};
const headers = [
@@ -156,7 +160,7 @@ const IncidentTable = ({
);
}
- if (!isLoading && incidents == undefined) {
+ if (!isLoading && !networkError && incidents?.length === 0) {
return (
{t("incidentsTableNoIncidents", "No incidents found")}
diff --git a/client/src/Pages/v1/Incidents2/Components/StatisticsPanel/index.jsx b/client/src/Pages/v1/Incidents2/Components/StatisticsPanel/index.jsx
index 5db635e56..ede9c619a 100644
--- a/client/src/Pages/v1/Incidents2/Components/StatisticsPanel/index.jsx
+++ b/client/src/Pages/v1/Incidents2/Components/StatisticsPanel/index.jsx
@@ -34,7 +34,7 @@ const StatisticsPanel = ({ isLoading = false, error = null, summary = {} }) => {
const theme = useTheme();
const { t } = useTranslation();
const totalResolutions =
- summary?.totalManualResolutions + summary?.totalAutomaticResolutions;
+ (summary?.totalManualResolutions || 0) + (summary?.totalAutomaticResolutions || 0);
const automaticPercentage =
totalResolutions > 0
? (summary?.totalAutomaticResolutions / totalResolutions) * 100
diff --git a/client/src/Pages/v1/Incidents2/hooks/useFetchIncidents.js b/client/src/Pages/v1/Incidents2/hooks/useFetchIncidents.js
index d65bb48db..a67f6b7ee 100644
--- a/client/src/Pages/v1/Incidents2/hooks/useFetchIncidents.js
+++ b/client/src/Pages/v1/Incidents2/hooks/useFetchIncidents.js
@@ -39,7 +39,7 @@ const useFetchIncidents = () => {
* @param {number} [config.page] - Page number
* @param {number} [config.rowsPerPage] - Rows per page
*/
- const fetchIncidentsByTeam = async (config = {}) => {
+ const fetchIncidentsByTeam = useCallback(async (config = {}) => {
try {
setIsLoading(true);
setNetworkError(false);
@@ -55,42 +55,51 @@ const useFetchIncidents = () => {
} finally {
setIsLoading(false);
}
- };
+ }, []);
/**
* Fetch active (open) incidents - Default function
*
* @param {Object} config - Additional configuration
*/
- const fetchActiveIncidents = async (config = {}) => {
- await fetchIncidentsByTeam({
- status: true,
- sortOrder: "desc",
- ...config,
- });
- };
+ const fetchActiveIncidents = useCallback(
+ async (config = {}) => {
+ await fetchIncidentsByTeam({
+ status: true,
+ sortOrder: "desc",
+ ...config,
+ });
+ },
+ [fetchIncidentsByTeam]
+ );
/**
* Fetch resolved incidents
*
* @param {Object} config - Additional configuration
*/
- const fetchResolvedIncidents = async (config = {}) => {
- await fetchIncidentsByTeam({
- status: false,
- sortOrder: "desc",
- ...config,
- });
- };
+ const fetchResolvedIncidents = useCallback(
+ async (config = {}) => {
+ await fetchIncidentsByTeam({
+ status: false,
+ sortOrder: "desc",
+ ...config,
+ });
+ },
+ [fetchIncidentsByTeam]
+ );
/**
* Fetch incidents with custom filters (alias for fetchIncidentsByTeam)
*
* @param {Object} config - Configuration object
*/
- const fetchIncidents = async (config = {}) => {
- await fetchIncidentsByTeam(config);
- };
+ const fetchIncidents = useCallback(
+ async (config = {}) => {
+ await fetchIncidentsByTeam(config);
+ },
+ [fetchIncidentsByTeam]
+ );
/**
* Fetch a single incident by ID
@@ -98,9 +107,9 @@ const useFetchIncidents = () => {
* @param {string} incidentId - The ID of the incident to fetch
* @returns {Promise