Search code examples
c#reactiveuiakavache

ReactiveList.AddRange not working for large collections


I have a simple TableView that displays a list of strings downloaded from the network. The list is very large (~140k strings). Using AddRange and nothing is happening, but if I statically code a small 2-item list, it works fine.

Code for reload command in view model:

        public ReactiveCommand<List<string>> LoadItems { get; protected set; }

        // Later, in the constructor...

        LoadItems = ReactiveCommand.CreateAsyncObservable(_ => BlobCache.LocalMachine.GetAndFetchLatest(
            client.ItemListKey,
            client.FetchItemList));

        LoadItems.Subscribe(list => {
            ItemList.Clear();
            ItemList.AddRange(list);
        }); 

If I change it to something like this, though, it actually adds cells to the table view:

        LoadItems.Subscribe(list => {
            Console.WriteLine(list.Count); // To see if it's working (it is)
            var stuff = new List<string>() {
                "Test item!"
            };
            ItemList.AddRange(stuff);
        }); 

My guess is that I'm adding the items in a very inefficient way and it's just not returning from the AddRange call. I'm VERY new to Rx/ReactiveUI/MVVM/all-this-cool-linq-stuff, but the premise is pretty awesome.

For what it's worth - I'm trying to do this on MonoTouch.


Solution

  • Looks like this issue was fixed in ReactiveUI 6.2.1.