You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
The key has expired.
@metamask/base-controller 4.1.0
Added
Add registerInitialEventPayload to ControllerMessenger and RestrictedControllerMessenger (#3697)
This allows registering an event payload function for an event, which has the benefit of ensuring the "subscription selector" feature works correctly the first time the event is fired after subscribing.
Fixed
Fix subscribe method selector support on first publish (#3697)
An event with a registered initial event payload function will work better with selectors, in that it will correctly compare with the initial selected state and return the previous value the first time it's published. Without this, the initial published event will always return undefined as the previous value.
Subscribers to the stateChange event of any BaseControllerV2-based controllers will now correctly handle the initial state change event (#3702)
Previously the initial state change would always result in this event firing, even for subscriptions with selectors where the selected value has not changed. Additionally, the previousValue returned was always set to undefined the first time.
BaseControllerV2 has been updated to correctly compare with the previous value even for the first state change. The returned previousValue is also now guaranteed to be correct even for the initial state change.