Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 4827ba6

Browse files
committed
Make TrackingCollection refreshable
1 parent a75f2e2 commit 4827ba6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/GitHub.Exports.Reactive/Collections/TrackingCollection.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public TrackingCollection(Func<T, T, int> comparer = null, Func<T, int, IList<T>
8888
this.filter = filter;
8989
}
9090

91+
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
9192
public TrackingCollection(IObservable<T> source,
9293
Func<T, T, int> comparer = null,
9394
Func<T, int, IList<T>, bool> filter = null,
@@ -109,6 +110,10 @@ public IObservable<T> Listen(IObservable<T> obs)
109110
if (disposed)
110111
throw new ObjectDisposedException("TrackingCollection");
111112

113+
disposables.Clear();
114+
while (!queue.IsEmpty)
115+
GetFromQueue();
116+
112117
sourceQueue = obs
113118
.Do(data => queue.Enqueue(new ActionData(data)));
114119

0 commit comments

Comments
 (0)