Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Make call to updateMetamaskNotificationsList async and fix its event emission. #4826

Merged
merged 3 commits into from
Oct 22, 2024

Conversation

hmalik88
Copy link
Contributor

@hmalik88 hmalik88 commented Oct 21, 2024

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

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@hmalik88 hmalik88 requested a review from a team as a code owner October 21, 2024 22:10
@hmalik88 hmalik88 merged commit 5576c64 into main Oct 22, 2024
119 checks passed
@hmalik88 hmalik88 deleted the hm/fix-update-action branch October 22, 2024 08:45
matteoscurati added a commit that referenced this pull request Oct 22, 2024
## Explanation

This is a RC for v224.0.0. See changelog for more details

@metamask/notification-services-controller:0.10.1

## References

- https://consensyssoftware.atlassian.net/browse/NOTIFY-1230
- https://consensyssoftware.atlassian.net/browse/NOTIFY-1238

## Changelog

```
## [0.11.0]

### Added

- Added support for an optional FCM token parameter for push notifications on mobile platforms, allowing native handling of FCM token creation through the Firebase SDK ([#4823](#4823))

### Changed

- update the types described in `types/on-chain-notification/schema` and `types/on-chain-notification/on-chain-notification` ([#4818](#4818))

  - adds new notifications: aave_v3_health_factor; ens_expiration; lido_staking_rewards; notional_loan_expiration; rocketpool_staking_rewards; spark_fi_health_factor
  - splits Wallet Notifications from Web 3 Notifications

- updated and added new notification mocks ([#4818](#4818))
  - can be accessed through `@metamask/notification-services-controller/notification-services/mocks`

### Fixed

- made `updateMetamaskNotificationsList` function work correctly by making the message handler async and moving the publish call outside of the update function. This ensures the `NotificationServicesController:notificationsListUpdated` event is received by the extension ([#4826](#4826))
```

## 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants