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

Notify if needed before deferring subscriber notifications #251

Merged
merged 9 commits into from
Mar 3, 2024

Conversation

ShirShintel
Copy link
Contributor

@ShirShintel ShirShintel commented Feb 18, 2024

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.

@ShirShintel ShirShintel changed the title notify before defer Notify if needed before deferring subscriber notifications Feb 19, 2024
@ShirShintel ShirShintel marked this pull request as ready for review February 28, 2024 07:19
Copy link
Contributor

@shirlynwix shirlynwix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing!

@ShirShintel ShirShintel requested a review from itsh01 February 29, 2024 09:36
@ShirShintel ShirShintel merged commit d250474 into master Mar 3, 2024
1 check passed
@ShirShintel ShirShintel deleted the notify-before-defer branch March 3, 2024 10:05
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