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

Feature: SuspendNotifications Methods for SourceCache / IntermediateCache #852

Merged
merged 16 commits into from
Feb 20, 2024

Conversation

dwcullop
Copy link
Member

@dwcullop dwcullop commented Feb 14, 2024

Description

Adds the INotifyCollectionChangedSuspender interface to IntermediateCache and SourceCache which adds SuspendNotifications and SuspendCount methods which will block either the ChangeSet observable or the CountChanged observable (respectively) until the IDisposable that the method returns is Disposed.

CountChanged will always emit the current count on subscription, but no further changes will be emitted until the suspension is complete, when it will emit the updated count (if it has changed). Connect will not emit any ChangeSets upon subscription when suspended. When the suspension is complete, it will emit a single changeset with the most recent contents and all a changeset for all future changes.

For subscriptions created BEFORE the suspension, no more changesets will be emitted until the suspension is complete, and then a single changeset, with ALL the changes that have been made will be emitted at once.

Both suspensions can be invoked multiple times and all IDisposables have to be Disposed before messages will resume.

@dwcullop dwcullop changed the title Feature: Deferred Group Updater Feature: SuspendNotifications Method for SourceCache / IntermediateCache Feb 18, 2024
@dwcullop dwcullop self-assigned this Feb 18, 2024
@dwcullop dwcullop marked this pull request as ready for review February 18, 2024 23:43
@dwcullop dwcullop changed the title Feature: SuspendNotifications Method for SourceCache / IntermediateCache Feature: SuspendNotifications Methods for SourceCache / IntermediateCache Feb 19, 2024
@dwcullop dwcullop enabled auto-merge (squash) February 19, 2024 19:57
Copy link
Collaborator

@JakenVeina JakenVeina left a comment

Choose a reason for hiding this comment

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

Functionally, I don't see anything missing or broken here.

src/DynamicData/Cache/ObservableCache.cs Outdated Show resolved Hide resolved
src/DynamicData/Cache/ObservableCache.cs Outdated Show resolved Hide resolved
src/DynamicData/Cache/ObservableCache.cs Outdated Show resolved Hide resolved
src/DynamicData/Cache/ObservableCache.cs Outdated Show resolved Hide resolved
src/DynamicData/Cache/ObservableCache.cs Outdated Show resolved Hide resolved
src/DynamicData/Cache/ObservableCache.cs Outdated Show resolved Hide resolved
src/DynamicData/Cache/ObservableCache.cs Outdated Show resolved Hide resolved
@dwcullop dwcullop merged commit f92a7f4 into reactivemarbles:main Feb 20, 2024
1 check passed
@dwcullop dwcullop deleted the feature/deferred-group-updater branch February 20, 2024 16:02
dwcullop added a commit that referenced this pull request Feb 22, 2024
…eSet (#863)

Fixes #851 by leveraging the code from #852 to suspend the notifications about changes to the group contents until all of the groups have been updated.
Copy link

github-actions bot commented Mar 6, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants