From 0652d29a0fa3d616eedc1eef8626cd5a0dce4289 Mon Sep 17 00:00:00 2001 From: Hassan Malik Date: Mon, 21 Oct 2024 18:01:28 -0400 Subject: [PATCH] fix action and move publish event call to outside of the update function --- .../NotificationServicesController.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.ts b/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.ts index 34b65bb136..a9b6c38b81 100644 --- a/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.ts +++ b/packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.ts @@ -577,7 +577,7 @@ export default class NotificationServicesController extends BaseController< #registerMessageHandlers(): void { this.messagingSystem.registerActionHandler( `${controllerName}:updateMetamaskNotificationsList`, - this.updateMetamaskNotificationsList.bind(this), + async (...args) => this.updateMetamaskNotificationsList(...args), ); this.messagingSystem.registerActionHandler( @@ -1375,12 +1375,13 @@ export default class NotificationServicesController extends BaseController< processedNotification, ...state.metamaskNotificationsList, ]; - this.messagingSystem.publish( - `${controllerName}:notificationsListUpdated`, - state.metamaskNotificationsList, - ); } }); + + this.messagingSystem.publish( + `${controllerName}:notificationsListUpdated`, + this.state.metamaskNotificationsList, + ); } } }