From 5e2fb59302de9a589412b6aa4f2afdb149d63433 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Thu, 10 Oct 2024 16:43:41 +0530 Subject: [PATCH] fix: Cannot read properties of undefined (reading 'read_at') --- .../dashboard/store/modules/notifications/mutations.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/javascript/dashboard/store/modules/notifications/mutations.js b/app/javascript/dashboard/store/modules/notifications/mutations.js index 333190d1a..2fb365beb 100644 --- a/app/javascript/dashboard/store/modules/notifications/mutations.js +++ b/app/javascript/dashboard/store/modules/notifications/mutations.js @@ -33,7 +33,7 @@ export const mutations = { // On reconnect, if there is existing notification with same primary_actor_id, // it will be deleted and the new one will be added. So it will solve with duplicate notification if (existingNotification) { - $state.records[existingNotification.id] = undefined; + delete $state.records[existingNotification.id]; } $state.records[notification.id] = { @@ -72,7 +72,7 @@ export const mutations = { }, [types.DELETE_NOTIFICATION]($state, data) { const { notification, unread_count: unreadCount, count } = data; - $state.records[notification.id] = undefined; + delete $state.records[notification.id]; $state.meta.unreadCount = unreadCount; $state.meta.count = count; }, @@ -83,7 +83,7 @@ export const mutations = { [types.DELETE_READ_NOTIFICATIONS]: $state => { Object.values($state.records).forEach(item => { if (item.read_at) { - $state.records[item.id] = undefined; + delete $state.records[item.id]; } }); },