From 466e9b5d7a2274e85fa62f4ae4990500455b532a Mon Sep 17 00:00:00 2001
From: Johanna Szepanski <johanna.szepanski@softhouse.se>
Date: Wed, 10 Jul 2024 14:17:37 +0200
Subject: [PATCH] fixed a bug, safeguard alerts being null

---
 src/components/Job/JobDetails.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/components/Job/JobDetails.js b/src/components/Job/JobDetails.js
index fb486a95..bad9a60e 100644
--- a/src/components/Job/JobDetails.js
+++ b/src/components/Job/JobDetails.js
@@ -103,7 +103,8 @@ export const JobDetails = ({ operation, job }) => {
   );
 
   useEffect(() => {
-    setAlerts([createAlert(jobOperation, job), ...operation.alerts]);
+    const operationAlerts = operation.alerts ? operation.alerts : [];
+    setAlerts([createAlert(jobOperation, job), ...operationAlerts]);
   }, [operation, job, jobOperation]);
 
   return (
-- 
GitLab