From ddb2b55c4203f6beb65b267477503ee22603501d Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Tue, 6 May 2025 10:52:17 -0700 Subject: [PATCH 1/3] uncomment notifications for pagespeed --- client/src/Features/PageSpeedMonitor/pageSpeedMonitorSlice.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/Features/PageSpeedMonitor/pageSpeedMonitorSlice.js b/client/src/Features/PageSpeedMonitor/pageSpeedMonitorSlice.js index 11cbcb36c..3ed2da13f 100644 --- a/client/src/Features/PageSpeedMonitor/pageSpeedMonitorSlice.js +++ b/client/src/Features/PageSpeedMonitor/pageSpeedMonitorSlice.js @@ -101,7 +101,7 @@ export const updatePageSpeed = createAsyncThunk( name: monitor.name, description: monitor.description, interval: monitor.interval, - // notifications: monitor.notifications, + notifications: monitor.notifications, }; const res = await networkService.updateMonitor({ monitorId: monitor._id, From 4bc9f59d809c25035c77026f5f8c1e25b328dfea Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Tue, 6 May 2025 10:53:07 -0700 Subject: [PATCH 2/3] fix loading prop --- client/src/Pages/PageSpeed/Monitors/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/Pages/PageSpeed/Monitors/index.jsx b/client/src/Pages/PageSpeed/Monitors/index.jsx index f10ba73d0..9963e429c 100644 --- a/client/src/Pages/PageSpeed/Monitors/index.jsx +++ b/client/src/Pages/PageSpeed/Monitors/index.jsx @@ -62,7 +62,7 @@ const PageSpeed = () => { Date: Tue, 6 May 2025 11:05:13 -0700 Subject: [PATCH 3/3] provide default empty notification array --- server/controllers/monitorController.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/server/controllers/monitorController.js b/server/controllers/monitorController.js index 6295a9aba..5ab654375 100755 --- a/server/controllers/monitorController.js +++ b/server/controllers/monitorController.js @@ -538,18 +538,16 @@ class MonitorController { const monitorBeforeEdit = await this.db.getMonitorById(monitorId); // Get notifications from the request body - const notifications = req.body.notifications; - + const notifications = req.body.notifications ?? []; const editedMonitor = await this.db.editMonitor(monitorId, req.body); await this.db.deleteNotificationsByMonitorId(editedMonitor._id); await Promise.all( - notifications && - notifications.map(async (notification) => { - notification.monitorId = editedMonitor._id; - await this.db.createNotification(notification); - }) + notifications.map(async (notification) => { + notification.monitorId = editedMonitor._id; + await this.db.createNotification(notification); + }) ); // Delete the old job(editedMonitor has the same ID as the old monitor)