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]: Provide Bind() options to choose whether to Remove/Add or Update #641

Closed
RolandPheasant opened this issue Sep 13, 2022 · 1 comment · Fixed by #642
Closed

Comments

@RolandPheasant
Copy link
Collaborator

RolandPheasant commented Sep 13, 2022

Describe the functionality desired 🐞

Originally for Cache.Bind() for unsorted streams, an update was achieved by removing the original item and adding the updated item at the end of the list. This behaviour was changed here: #381 to fix this issue #378 .

However, it was a mistake to do this as some platforms do not support replace notifications, and some users have reported issues (including #640). Instead, we should revert to the original default remove / add, and provide an option for a consumer to opt-in to using replace.

This will be addressed by an extra param on the bind methods

// use replace for updates
var collection = new ObservableCollectionExtended<MyType>();
using var binder = source.Connect().Bind(collection, useReplaceForUpdates: true).Subscribe();

// use remove / add for updates
var collection = new ObservableCollectionExtended<MyType>();
using var binder = source.Connect().Bind(collection).Subscribe();

Similarly for ReadOnlyObservableCollection

// use replace for updates
using var binder = source.Connect().Bind(var out myReadonly, useReplaceForUpdates: true).Subscribe();

// use remove / add for updates
using var binder = source.Connect().Bind(var out myReadonly).Subscribe();

The steps the functionality will provide

Described in the description

Considerations

It will break some users, but the reverting to the original is the best solution

RolandPheasant added a commit that referenced this issue Sep 13, 2022
…r which uses remove / add instead of replace + add an option to use replace. Fixes #641. Fixes #640. Reverts #381
RolandPheasant added a commit that referenced this issue Sep 13, 2022
…r which uses remove / add instead of replace + add an option to use replace. Fixes #641. Fixes #640. Reverts #381
RolandPheasant added a commit that referenced this issue Sep 13, 2022
…r which uses remove / add instead of replace + add an option to use replace. Fixes #641. Fixes #640. Reverts #381 (#642)
@github-actions
Copy link

This issue 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 Sep 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant