-
-
Notifications
You must be signed in to change notification settings - Fork 182
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
[BUG] Connect with predicate not showing initial state as previous when next updates occur in future. #400
Comments
This is serious. I will look at it and hopefully find a solution which does not use |
@RolandPheasant - Any updates for this bug? Can confirm I'm seeing it too in our application. |
@RolandPheasant - not trying to be a pest, but I'm also wondering if you have any updates on this? We happen to be clearing our Here are some other unit tests. [Fact]
public void ClearingSourceCacheWithPredicateShouldClearTheData()
{
// having
var source = new SourceCache<int, int>(it => it);
source.AddOrUpdate(1);
var results = source.Connect(it => true).AsAggregator();
// when
source.Clear();
// then
results.Data.Count.Should().Be(0, "Should be 0");
} A potential workaround for some is to use [Fact]
public void ClearingSourceCacheWithFilterShouldClearTheData()
{
// having
var source = new SourceCache<int, int>(it => it);
source.AddOrUpdate(1);
var results = source.Connect().Filter(it => true).AsAggregator();
// when
source.Clear();
// then
results.Data.Count.Should().Be(0, "Should be 0");
} |
It looks like I have encountered the same issue. This is a s big problem for us. |
Sorry for the delay (very long). The following is a hack to replace
All unit tests pass. I just need to sit on it overnight to think about whether there are any ramifications + I will also pull the observable return hack into an extension method as it will also be need elsewhere. |
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. |
Describe the bug
When connected with predicate initial state of the observable collection is not seen as previous when the next updates occur.
I think its bug, as it working differently before commit 63960b0, which change behaviour of connect().
Steps To Reproduce
Example of unit tests that reproduce the issue.
(in my opinion, both should pass, and they are doing that with code before 63960b0)
Expected behavior
The initial state should be visible as previous if we connect with non-null predicate.
Environment
Additional context
I think that problem is with the code in ObservableCache.cs in Connect()
We do not take into account that we OnNext is not enough for proper handling of initial state.
Code below solve the problem
Unfortunately, I looked into the history of bugs and I found this that stating that Observable.Return could trigger some memory leaks, so I'm not sure if this is the correct solution.
The text was updated successfully, but these errors were encountered: