Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Make call to
updateMetamaskNotificationsList
async and fix its…
… event emission. (#4826) ## Explanation * What is the current state of things and why does it need to change? The `updateMetamaskNotificationsList` function is async and the registered message handler should also have been async. The `NotificationServicesController:notificationsListUpdated` event is not being received by the extension. * What is the solution your changes offer and how does it work? Make the message handler async and move the publish call outside of the update function. * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? This problem was never uncovered because the `updateMetamaskNotfiicationsList` function was never called in the extension until now (with snaps). When triggering a notification, with the current state of things, the extension would not update the badge counter because it wasn't receiving the `NotificationServicesController:notificationsListUpdated` event. ## Changelog ### `@metamask/notification-services-controller` - **FIXED**: `updateMetamaskNotificationsList` was fixed by updating the message handler and moving the publish call outside of the update to state in the function. ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes
- Loading branch information