This PR fixes a bug with deferSubscriberNotifications, where it's called right after a state update.
In general, when dispatching a state update, we update pendingBroadcastNotification and notify all on the next animation frame.
When calling deferSubscriberNotifications right after a dispatch, we face with a case where we should have notified subscribers, but there was no animation frame yet, and so we start deferring notification before notifying on the previous state update. Meaning, we do not notify about the state update that happened right before we started deferring until we stop deferring all notifications.
This is an unexpected behaviour, and to solve this, this PR adds executes all pending actions before starting to defer notifications, in case there are pending subscribers\observables\flush.
This PR fixes a bug with
deferSubscriberNotifications
, where it's called right after a state update.In general, when dispatching a state update, we update
pendingBroadcastNotification
and notify all on the next animation frame. When callingdeferSubscriberNotifications
right after a dispatch, we face with a case where we should have notified subscribers, but there was no animation frame yet, and so we start deferring notification before notifying on the previous state update. Meaning, we do not notify about the state update that happened right before we started deferring until we stop deferring all notifications.This is an unexpected behaviour, and to solve this, this PR adds executes all pending actions before starting to defer notifications, in case there are pending subscribers\observables\flush.